本文整理汇总了PHP中CController::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP CController::redirect方法的具体用法?PHP CController::redirect怎么用?PHP CController::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CController
的用法示例。
在下文中一共展示了CController::redirect方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect
/**
* @param mixed $url
* @param bool $terminate
* @param int $statusCode
*/
public function redirect($url, $terminate = true, $statusCode = 302)
{
if ($url == ':back' && isset($_SERVER['HTTP_REFERER'])) {
$url = $_SERVER['HTTP_REFERER'];
}
parent::redirect($url, $terminate, $statusCode);
}
示例2: redirect
/**
If there's a returnTo, then use it.
XXX this may break with ajax, watch out
**/
public function redirect($url, $terminate = true, $statusCode = 302)
{
if (isset($_GET['returnTo'])) {
// NOTE: do NOT use an array!!
parent::redirect(urldecode($_GET['returnTo']));
} else {
parent::redirect($url, $terminate, $statusCode);
}
}
示例3: filter
public function filter($filterChain)
{
if (!$this->preFilter($filterChain)) {
if (Yii::app()->controller->id === $this->login_controller) {
CController::redirect($this->login_action);
} else {
CController::redirect($this->login_controller . '/' . $this->login_action);
}
} else {
$filterChain->run();
}
}
示例4: beforeControllerAction
public function beforeControllerAction($controller, $action)
{
if (parent::beforeControllerAction($controller, $action)) {
if (Yii::app()->user->isGuest) {
CController::redirect('index.php?r=login');
}
if (!in_array($this->name, ModuluserK::modulUser(Yii::app()->user->id))) {
throw new CHttpException(401, Yii::t('mds', 'You are prohibited to access this page. Contact Super Administrator'));
}
return true;
} else {
return false;
}
}
示例5: redirect
/**
* Phương thức redirect($url, $terminate=true, $statusCode=302) dùng để redirect user đến url
*
* @param $url string/array
* @param $terminate boolean
* @param $statusCode int
*/
public function redirect($url, $terminate = true, $statusCode = 302)
{
if (!empty($this->_redirectOptions)) {
if (is_array($url)) {
$route = isset($url[0]) ? $url[0] : '';
$url = $this->createUrl($route, array_splice($url, 1));
}
$this->_redirectOptions['url'] = $url;
$this->render('//common/redirect', array('redirectOptions' => $this->_redirectOptions));
Yii::app()->end();
} else {
parent::redirect($url, $terminate, $statusCode);
}
}
示例6: redirect
public function redirect($params)
{
if (isset($_GET['popup']))
{
if (is_array($params))
{
$view = array_shift($params);
$params['popup'] = 1;
array_unshift($params, $view);
}
}
parent::redirect($params);
}
示例7: redirect
/**
* Redirects the browser to a given URL.
*
* @param string $url The URL to redirect the browser to.
* @param bool $terminate Whether the request should be terminated.
* @param int $statusCode The status code to accompany the redirect. (Default is 302.)
*
* @return null
*/
public function redirect($url, $terminate = true, $statusCode = 302)
{
if (is_string($url)) {
$url = UrlHelper::getUrl($url);
}
if ($url !== null) {
parent::redirect($url, $terminate, $statusCode);
}
}
示例8: redirect
public function redirect($url, $terminate = true, $statusCode = 302)
{
if (Yii::app()->request->isAjaxRequest) {
return;
}
parent::redirect($url, $terminate, $statusCode);
}