- 论坛徽章:
- 1
|
我按照php资料中的file写了以下一段程序(复制粘贴的),目的是为了测试自动生成静态网页的问题:
<?php
// 将一个文件读入数组。本例中通过 HTTP 从 URL 中取得 HTML 源文件。
$lines = file ('http://www.mytest.org/');
// 在数组中循环,显示 html 的源文件并加上行号。
foreach ($lines as $line_num =>; $line) {
echo "Line #<b>;{$line_num}</b>; : " . htmlspecialchars($line) . "<br>;\n";
}
?>;
照说明,应该是返回www.mytest.org的首页的文件(mytest.org是我本地的一个测试地址),但运行却报错:
Warning: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/www/html/test.php on line 3
Warning: file("http://www.mytest.org/" - Bad file descriptor in /home/www/html/test.php on line 3
请问有谁知道这是怎么回事? 难道file对系统有什么特别要求吗? 请高手们不吝赐教! 谢谢
PS:我的运行环境是Linux+apache2+php4 |
|