1 回答

TA貢獻1796條經驗 獲得超10個贊
看看你的memory_limit
. 錯誤說Allowed memory size of 2097152 bytes exhausted
。哪個不是2GB
console.log(2097152 / 2**20 + "MB");
var_dump(ini_get('memory_limit'));
function memstat($file, $line) {
echo sprintf(
'mem @ %s %d: %.2f MB (%.2f MB; peak: %.2f MB)' . PHP_EOL,
$file,
$line,
memory_get_usage() /2**20,
memory_get_usage(true) /2**20,
memory_get_peak_usage() /2**20
);
}
memstat(__FILE__, __LINE__);
$str = str_pad('', 9999999, ' ');
memstat(__FILE__, __LINE__);
print 'end '.strlen($str);
工作示例。
輸出
string(3) "64M"
mem @ /in/BHqWd 16: 0.37 MB (2.00 MB; peak: 0.41 MB)
mem @ /in/BHqWd 18: 9.91 MB (11.54 MB; peak: 9.91 MB)
end 9999999
- 1 回答
- 0 關注
- 94 瀏覽
添加回答
舉報