Last active
December 17, 2015 00:49
-
-
Save PizzaLiu/5523982 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pheader($string,$exit=true,$replace = true, $http_response_code = 0) { | |
$host = $_SERVER['HTTP_HOST']; | |
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); | |
$string = str_replace(array("\r", "\n"), array('', ''), $string); | |
if(empty($http_response_code) || PHP_VERSION < '4.3' ) { | |
@header("Location: http://$host$uri/$string", $replace); | |
} else { | |
@header("Location: http://$host$uri/$string", $replace, $http_response_code); | |
} | |
if($exit) { | |
exit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment