有两种办法:
第一使用:设置超时时间
ini_set("max_execution_time", 2);
$url
= "
http://www.0377joyous.com/
test.
php
";
$html = @file_get_contents($url);
echo $html;
第二种使用:get_headers()
这个函数会返回一个数组
$url = ‘http://www.0377joyous.com/test.php’; if (get_headers($url)<>false) {
$url
= "
http://www.0377joyous.com/
test.php";
$html = @file_get_contents($url);
echo $html;
} else { echo “文件不存在”; }