时间:2021-07-01 10:21:17 帮助过:17人阅读
Thinkphp中 重定向redirect、和跳转success、error的区别
三个方法同时传入 U(MODULE_NAME . '/Public/index') 这个URL参数时候
redirect生成的地址会多个index.php,导致访问出错, 但是当使用URL_MODEL=2伪静态时候却没有问题
查看redirect源代码 :
- /**
- * Action跳转(URL重定向) 支持指定模块和延时跳转
- * @access protected
- * @param string $url 跳转的URL表达式
- * @param array $params 其它URL参数
- * @param integer $delay 延时跳转的时间 单位为秒
- * @param string $msg 跳转提示信息
- * @return void
- */
- protected function redirect($url,$params=array(),$delay=0,$msg='') {
- $url = U($url,$params);
- redirect($url,$delay,$msg);
- }
因为redirect需要的是字符串不是U函数生成的地址!
success 和 error 则不同的是,他们内部没有使用U生成需要传入时生成URL 。
以上就是详解Thinkphp中重定向redirect和跳转success、error的区别的详细内容,更多请关注gxlcms其它相关文章!