web\Controller goBack()

goBack() public method

Redirects the browser to the last visited page.

You can use this method in an action by returning the yii\web\Response directly:

// stop executing this action and redirect to last visited page
return $this->goBack();

For this function to work you have to set the return URL in appropriate places before.

See also yii\web\User::getReturnUrl().

public yii\web\Response goBack ( $defaultUrl = null )
$defaultUrl string|array

The default return URL in case it was not set previously. If this is null and the return URL was not set previously, yii\web\Application::$homeUrl will be redirected to. Please refer to yii\web\User::setReturnUrl() on accepted format of the URL.

return yii\web\Response

The current response object

doc_Yii
2016-10-30 17:14:45
Comments
Leave a Comment

Please login to continue.