Commit ba1496cd by Qiang Xue

doc fix.

parent 40629ca4
...@@ -559,7 +559,20 @@ class Response extends \yii\base\Response ...@@ -559,7 +559,20 @@ class Response extends \yii\base\Response
/** /**
* Redirects the browser to the specified URL. * Redirects the browser to the specified URL.
* *
* This method will send out a "Location" header to achieve the redirection. * This method adds a "Location" header to the current response. Note that it does not send out
* the header until [[send()]] is called. In a controller action you may use this method as follows:
*
* ~~~
* return Yii::$app->getResponse()->redirect($url);
* ~~~
*
* In other places, if you want to send out the "Location" header immediately, you should use
* the following code:
*
* ~~~
* Yii::$app->getResponse()->redirect($url)->send();
* return;
* ~~~
* *
* In AJAX mode, this normally will not work as expected unless there are some * In AJAX mode, this normally will not work as expected unless there are some
* client-side JavaScript code handling the redirection. To help achieve this goal, * client-side JavaScript code handling the redirection. To help achieve this goal,
...@@ -578,12 +591,6 @@ class Response extends \yii\base\Response ...@@ -578,12 +591,6 @@ class Response extends \yii\base\Response
* }); * });
* ~~~ * ~~~
* *
* In a controller action you may use this method like this:
*
* ~~~
* return Yii::$app->getResponse()->redirect($url);
* ~~~
*
* @param string|array $url the URL to be redirected to. This can be in one of the following formats: * @param string|array $url the URL to be redirected to. This can be in one of the following formats:
* *
* - a string representing a URL (e.g. "http://example.com") * - a string representing a URL (e.g. "http://example.com")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment