The PHP jump, which redirects the browser to the specified URL, is a very common feature. This feature also has some detail requirements, such as how many seconds to wait after the jump, with no JavaScript to achieve jump, and so on. The following jump method takes into account a lot, and parameterization, can be used in specific projects.
<?php/** * Redirect browser to the specified URL * * @param string $url the URL to redirect * @param int $delay Wait how many seconds to jump * @param Boo L $JS Indicates whether to return JavaScript code for jumps * @param bool $jsWrapped Indicates whether to use when returning JavaScript code
!--label * @param bool $return Indicates whether the generated JavaScript code is returned */function redir ECT ($url, $delay = 0, $js = False, $jsWrapped = True, $return = False) {$delay = (int) $delay; if (! $js) {if (headers_sent () | | | $delay > 0) {echo <<
EOT; Exit } else {Header ("Location: {$url}"); Exit }} $out = '; if ($jsWrapped) {$out. = '
'; } if ($return) {return $out; } Echo $out; Exit }?>