fgetcsv不再工作了

时间:2013-05-24 18:44:24

标签: php fgetcsv

我在网页上使用此代码大约2年,突然间它开始给我一个错误。有没有明显的原因?这些是错误中引用的第116到120行

$file = fopen("http:/xxxxxx/climo/reports/".$fileName, "r");
              $content = fgetcsv($file, 1000, ",");

              $id = 1;
              while ($content = fgetcsv($file, 1000, ",") != FALSE) {

错误

.gov/climo/reports/today_raw_hail.csv) [function.fopen]: failed to open stream: no suitable wrapper could be found in /homepages/27/xxxx/htdocs/xxxxx/weather/php/mainEngine.php on line 116

Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /homepages/27/xxxxx/htdocs/xxxx/weather/php/mainEngine.php on line 117

Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /homepages/27/xxxx/htdocs/xxxx/weather/php/mainEngine.php on line 120

2 个答案:

答案 0 :(得分:2)

您的主持人可能更新了php.ini

中的'allow_url_fopen'指令

http://php.net/manual/en/filesystem.configuration.php

答案 1 :(得分:0)

显然您的托管服务提供商放弃了对http://网址的支持(正如您在错误中看到的那样)。

尝试使用curl来阅读csv。

相关问题