开发者

Symfony clear Post data

I need to clear the POST data ($request->getPostParameter()) so that if the user r开发者_开发百科efreshes the page the data does not get resubmitted. How do I do this in symfony?


The general rule in symfony is to redirect (not forward) in a controller that accepts post data, and presumably writes to the database. You can this behaviour in the generated action.class.php when using generate-module


I needed to reload previously loaded page without redirect, because the request was sent by ajax... so I processed the form and then just changed method from POST to GET, which prevent form resubmittion, and then forwarded request to another controller. Here is the code:

$request = $this->get('request');
$request->setMethod('GET');
$response = $this->forward($controller, $params);
return $response;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜