1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee
zxd_ctrlcenter/plugin/404/include.php

25 lines
723 B
PHP
Raw Normal View History

2022-01-26 02:20:35 +08:00
<?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();
}
}
}