25 lines
723 B
PHP
25 lines
723 B
PHP
<?php
|
|
function zxd_ctrlcenter_404(){
|
|
global $zbp;
|
|
if(!$zbp->Config('zxd_ctrlcenter')->plugin_404_Enable)
|
|
return false;
|
|
|
|
if (!in_array("Status: 404 Not Found", headers_list())) {
|
|
return false;
|
|
}
|
|
|
|
|
|
$url = $zbp->Config('zxd_ctrlcenter')->plugin_404_redirect_url;
|
|
|
|
$delay = $zbp->Config('zxd_ctrlcenter')->delay ?: 0;
|
|
if ($url && preg_match("/^http[s]?:\/\/.+\.\w+/", $url)){
|
|
// 采用 js 跳转兼容性好
|
|
if ($delay==0 && function_exists("RedirectByScript")) {
|
|
RedirectByScript($url);
|
|
}else{
|
|
// 采用 html
|
|
echo '<meta http-equiv="refresh" content="0;url=' . $url . '">';
|
|
die();
|
|
}
|
|
}
|
|
} |