Home  >  Article  >  PHP Framework  >  Detailed explanation of the difference between redirection and jump success and error in Thinkphp

Detailed explanation of the difference between redirection and jump success and error in Thinkphp

藏色散人
藏色散人forward
2021-03-18 17:16:572838browse

The following is the tutorial column of thinkphp to explain in detail the difference between redirect redirect and jump success and error in Thinkphp. I hope it will be helpful to friends in need!

Detailed explanation of the difference between redirection and jump success and error in Thinkphp

The difference between redirect, jump success and error in Thinkphp

Three methods are passed in at the same time U(MODULE_NAME . '/Public/index') When using this URL parameter,

redirect will generate multiple addresses for index.php, causing access errors, but when using URL_MODEL=2 pseudo-static, there is no problem

View the redirect source code:

/**
 * 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);
}

Because redirect requires a string and not an address generated by the U function!

The difference between success and error is that they do not use U internally to generate the URL when it needs to be passed in.

The above is the detailed content of Detailed explanation of the difference between redirection and jump success and error in Thinkphp. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete