> Yaf中文手册 > Yaf_Controller_Abstract::redirect

名称

Yaf_Controller_Abstract::redirect

(Since Yaf 1.0.0.5)

public boolean Yaf_Controller_Abstract::redirect( string  $url );

重定向请求到新的路径

参数
$url

要定向的路径

返回值

成功返回Yaf_Controller_Abstract, 失败返回FALSE

例子

例 11.56. Yaf_Controller_Abstract::redirect 的例子

     
     <?php
     class IndexController extends Yaf_Controller_Abstract {
        public funciton init() {
           if($user_not_login)
              $this->redirect("/login/");
        }
     }
     ?>