<?php$url = " http://127.0.0.1/license/rank.php"; $contents = file_get_contents($url); echo $contents; ?>rank.php怎么知道是来自哪个域名的文件在读取内容啊
$url = $_SERVER["HTTP_REFERER"]; //获取完整的来路URL$str = str_replace("http://","",$url); //去掉http://$strdomain = explode("/",$str); // 以“/”分开成数组$domain = $strdomain[0]; //取第一个“/”以前的字符用上面的方法才准确无误,如果你用PHP自带的函数就不对如:$_SERVER['SERVER_NAME'] 这个函数它获取的是服务器域名
$_SERVER['REQUEST_URI'];$_SERVER['PHP_SELF'].'?'.$_SERVER['argv'][0]$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']