The redirect method of TP frame is how to realize jump? Look at the source code, totally incomprehensible.

Source: Internet
Author: User
The redirect method of TP frame is how to realize jump? A look at the source code, completely can not understand AH.
protected function Redirect ($url, $params =array (), $delay =0, $msg = ") {
$url = U ($url, $params);
Redirect ($url, $delay, $msg);
}



First live a URL, and then recursively pass in the third fourth parameter:


How does its jump come true???
------Solution--------------------
The redirect in the function body is called a function:

See the framework's built-in functions.php file
redirect
Description
void Redirect ($url, $time =0, $msg = ")
URL redirection
Source:


function Redirect ($url, $time =0, $msg = ") {
Multi-line URL address support
$url = Str_replace (Array ("\ n", "\ R"), ", $url);
if (empty ($msg))
$msg = "The system will automatically jump to {$url}! after {$time} seconds ";
if (!headers_sent ()) {
redirect
if (0 = = = $time) {
Header (' Location: '. $url);
} else {
Header ("refresh:{$time};url={$url}");
Echo ($msg);
}
Exit ();
} else {
$str = " ";
if ($time! = 0)
$str. = $msg;
Exit ($STR);
}
}
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.