诸位 老大 我有个问题 帮帮我吧
我的php.ini 文件里
allow_url_fopen=on
allow_url_include=on
但是file还是不能远程读取文件
<?php
$result=file("http://baidu.cn");
$result=join(" ",$result);
echo $result;
?>
显示为白屏
我应该怎么办呢
注:file("本地文件");是可以的
我的php.ini 文件里
allow_url_fopen=on
allow_url_include=on
但是file还是不能远程读取文件
<?php
$result=file("http://baidu.cn");
$result=join(" ",$result);
echo $result;
?>
显示为白屏
我应该怎么办呢
注:file("本地文件");是可以的
在本地的zend studio可以
但是一穿到我的php空间上就不行了
http://www.zhuxiaosheng.cn/sql/phpinfo.php 这是我服务器的配置情况
那为老大帮忙看一下吧 不知道问题出在怎么地方
<?php
$result=file_get_contents("http://www.zhuaxia.com/index.php");
$result=join(" ",$result);
echo $result;
?>
file返回的才是array类型你把file_get_contents换成file就可以了。
<?php
$result=file("http://www.zhuaxia.com/index.php");
$result=join(" ",$result);
echo $result;
?>
输出还是空白
<?php
$result=file("http://www.baidu.com");
$result=join(" ",$result);
echo $result;
?>
输出还是空白
但输出本地文件可以<?php
$result=file("login.html");
$result=join(" ",$result);
echo $result;
?>
输出正常
但是怎么样才能输出远程文件呢?在本地的zend studio可以
但是一穿到我的php空间上就不行了
http://www.zhuxiaosheng.cn/sql/phpinfo.php 这是我服务器的配置情况
那为老大帮忙看一下吧 不知道问题出在怎么地方
先确定一下是不是你PHP版本的问题,我试过使用php.4.4.2的版本使用file()函数是无法读取远程文件的。
如果不是上面的问题,那你将www.baidu.com换成对应的IP试一下,如果可以那说是服务器上的DNS问题。