php请求转发,Yaf 请求转发 请求重定向

请求转发:

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;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值