php后端对跳转的封装 /** * 页面跳转 * $url 跳转地址 * $time 一段时间后跳转 */function app_redirect($url,$time=0,$msg=''){ //多行URL地址支持 $url = str_replace(array("\n", "\r"), '', $url); if (!headers_sent()) {
/** * 页面跳转 * $url 跳转地址 * $time 一段时间后跳转 */ function app_redirect($url,$time=0,$msg='') { //多行URL地址支持 $url = str_replace(array("\n", "\r"), '', $url); if (!headers_sent()) { // redirect if(0===$time&&$msg=="") { if(substr($url,0,1)=="/") { if(defined("SITE_DOMAIN")) header("Location:".SITE_DOMAIN.$url); else header("Location:".$url); } else { header("Location:".$url); } }else { header("refresh:{$time};url={$url}"); //$time 后跳转 echo($msg); } exit(); }else { $str = ""; if($time!=0) $str .= $msg; exit($str); } }