请求转发:
public boolean Yaf_Controller_Abstract::forward( string $module ,
string $controller ,
string $action ,
array $params= NULL );
相关资料: http://yaf.laruence.com/manual/yaf.class.controller.forward.html
示例:
class IndexController extends Yaf_Controller_Abstract {
public funciton init() {
/**
* 如果用户没登陆, 则转给登陆动作
*/
if($user_not_login) {
$this->forward("login");
}
}
}
?>
请求重定向:
public boolean Yaf_Controller_Abstract::redirect( string $url );
相关资料:http://yaf.laruence.com/manual/yaf.class.controller.redirect.html
示例:
class IndexController extends Yaf_Controller_Abstract {
public funciton init() {
if($user_not_login)
$this->redirect("/login/");
}
}
?>
通过响应重定向
publicbooleanYaf_Response_Abstract::setRedirect( string $url );
相关资料:http://yaf.laruence.com/manual/yaf.class.response.setRedirect.html
通过header重定向
header("Location:http://www.baidu.com");
exit;