* 跳转定义
~~~
/**
* 回退
*
* @var string
*/
const JUMP_BACK = 'jump_back';
/**
* 刷新
*
* @var unknown
*/
const JUMP_REFRESH = 'jump_refresh';
/**
* 上一页
*
* @var unknown
*/
const JUMP_REFERER = 'jump_referer';
~~~
* 构造链接
~~~
/**
*
* {@inheritdoc}
*
* @see Controller::buildUrl()
*/
protected function buildUrl($url)
{
if ($url == static::JUMP_BACK) {
return 'javascript:history.go(-1);';
} elseif ($url == static::JUMP_REFRESH) {
return 'javascript:history.go(0);';
} elseif ($url == static::JUMP_REFERER) {
return 'javascript:location.href = document.referrer;';
} else {
return parent::buildUrl($url);
}
}
~~~
* 跳转链接
~~~
// 返回上一页
$this->success('操作成功', self::JUMP_BACK);
// 刷新页面
$this->success('操作成功', self::JUMP_REFRESH);
// 跳转到上一页(刷新)
$this->success('操作成功', self::JUMP_REFERER);
~~~