The header () that needs attention here is most often taken to send the header (' Location:/'); And so on, do the Web redirect action.
In use Setcookie (), header () ... You cannot use any output before such a function. Log records if necessary.
If there is output then Headers_sent will return true.
I am using TP directly in the PHP command Runtime (PHP index.php/home/login/test) found no return output, view the discovery,
There is a $this->redirect ("") function, which calls the redirect function indirectly, as follows:
/**
* URL Redirection
* @param string $url The URL address of the redirect
* Wait time for @param integer $time redirect (seconds)
* @param string $msg Prompt before redirection
* @return void
*/
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 = "<meta http-equiv= ' Refresh ' content= ' {$time}; url={$url} ' > ';
if ($time! = 0)
$str. = $msg;
Exit ($STR);
}
}
The description only executes the header (' Location: '. $url); Send to exit (); Command line run cannot receive the contents of the header currently do not know why?
If the header (' Location: ' $url), before the printout such as Echo can receive <meta http-equiv= ' Refresh ' content= ' 0; Url=./login/logout ' > information.
Please leave a message if you know.
PHP Header Setcookie headers_sent function function checks if the HTTP header has been sent and where it was sent