我读了几个类似的帖子,但我没有看到我的错。网址和标题与PHP片段
的index.php样子:
<head>
<title>Demo Title</title>
</head>
<body>
<?php
require_once "footer.php";
?>
</body>
footer.php的样子:
<?php
/*
* _$ Rev. : 08 Sep 2010 14:52:26 $_
* footer.php
*/
$host = $_SERVER['SERVER_NAME'];
$param = $_SERVER ['REQUEST_URI'];
$url = "http://".$host.$param;
echo $url;
$file = @ fopen($_SERVER[$url],"r") or die ("Can't open HTTP_REFERER.");
$text = fread($file,16384);
if (preg_match('/<title>(.*?)<\/title>/is',$text,$found)) {
$title = $found[1];
} else {
$title = " -- no title found -- ";
}
?>
一种URL请求http://127.0.0.1/test/index.php结果:
http://127.0.0.1/test/index.phpCan't open HTTP_REFERER.
http://127.0.0.1/test/Can't open HTTP_REFERER.
任何提示赞赏。
这不会导致您的服务器请求永不结束的循环吗?因为,你试图请求一个文件吐出来,所以每一个你对index.php做的打开你会导致它再次打开,等等!这是一个失败。这可能会解释你的评论下面的'服务器跑出线程服务请求' – RobertPitt 2010-09-08 13:16:23