file_get_contents停止工作,返回一个空字符串

时间:2012-08-20 18:33:20

标签: php file-get-contents string

我写了script,广泛使用file_get_contents。但它停止在一个地方工作,这是有问题的片段:

private function patch_codeigniter_file($file_location)
{
    $this->backup_file($file_location);
    $tmp = explode(DIRECTORY_SEPARATOR, $file_location);
    $file_name = end($tmp);
    $file = file_get_contents($file_location);

    // ...
}

file_get_contents返回一个空字符串。以下是关于背景的几个事实:

  • $file_location本地文件的绝对路径。
  • $file_location指向的文件(是的,这是事实)
  • file_get_contents不会返回任何错误。
  • error_reporting设置为-1
  • 我在OS X Mountain Lion上使用最新版本的MAMP,它附带PHP 5.4.4

有人知道问题可能是什么吗?就在今天早上file_get_contents工作正常,我尝试使用Windows 7虚拟机,它运行正常。

0 个答案:

没有答案