继续得到错误500,php file_get_contents

时间:2016-04-17 14:40:49

标签: php file-get-contents

在尝试使用php获取非常大的文件时,我一直收到错误500,

$get_file = file_get_contents("../../test/test.mp4", true); // the size of .mp4 is more than 2GB
echo $get_file;

任何人都知道我在这里做错了什么?

我的php.ini文件设置为处理4000 MB,(我不确定php是否可以处理那么多)..

感谢。

1 个答案:

答案 0 :(得分:0)

来自PHP manual

  

注意:字符串最大可达2GB(最大2147483647字节)

由于file_get_contents返回一个字符串......;)

相反,使用fopen检索文件指针资源,使用fread部分读取数据。