表示 进入内容 11
Displaying posts with tag: file_get_contents (reset)
php file_get_contents 读取大文件出错

php file_get_contents 读取大文件出错

Note: string can be as large as 2GB.
file_get_contents如果正常返回,会把文件内容储存到某个字符串中,所以它不应该返回超过2G长度的字符串。
如果文件内容超过2G,不加offset和maxlen调用file_get_contents的话,肯定会返回false,
在64位机上面啥错都不报啊,我晕:

PHP 5.4.16 (cli) (built: Jun  7 2013 14:32:19) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with XCache v3.0.2, Copyright (c) 2005-2013, by mOo
    with XCache Optimizer v3.0.2, Copyright (c) 2005-2013, by mOo
    with XCache Cacher v3.0.2, Copyright (c) 2005-2013, by mOo
    with XCache Coverager v3.0.2, Copyright (c) 2005-2013, by mOo

回到32位机,报这样的错:
PHP 5.3.10 (cli) (built: Jul 7 2012 12:30:39)
Copyright …

[获取更多]
表示 进入内容 11