我有以下代码:
$fh=fopen($api,"r");
$theData = fgets($fh);
echo $theData;这会抛出如下错误:
Warning: fopen(http://xxxxxx.xxxxxxxx.com:8080) [function.fopen]: failed to open stream: Connection refused in /home/xxxx/public_html/xxxx/index.php on line 18
Warning: fgets(): supplied argument is not a valid stream resource in /home/xxxx/public_html/xxxx/index.php on line 19这个问题的解决方案是什么?
发布于 2012-09-19 22:35:16
您的文件未按预期打开。检查$api的值,并确保文件名位于当前工作目录中,或文件的完整路径中。
由于它是位于:8080上的远程系统,因此请确保端口对公众开放。这通常是为localhost保留的值(即: you服务器只是该计算机的you服务器,而不是其他计算机的you服务器),您将无法访问。如果您打开的url与您正在使用的计算机相同,请改为使用本地文件夹导航到该文件。
https://stackoverflow.com/questions/12496928
复制相似问题