PHP判断域名是否存在指定文件,不存在就301到其他

$domaintxt=file_get_contents(path ."/host/host.txt");
$yum=$_SERVER['HTTP_HOST'];
$ymz=explode('.', $yum);
if(!stristr($domaintxt,$ymz[count($ymz) - 2]) ){
//$domainsz=file(DIR ."/list/domains/domains.txt");
//$mb301=trim(varray_rand( $domainsz));
header('HTTP/1.1 301 Moved Permanently');
header("Location: http://www.shjlqq.com ");
exit;
}

原文地址:https://www.cnblogs.com/paddygege/p/7240993.html