我有这个简单的 PHP 脚本,它只包含以下几行
$mem = memory_get_usage()/1024;
$mem = $mem/1024;
echo "mem: ".$mem ."Mb<br>";
$max = ini_get('memory_limit');
echo "max is $max<br>";
$filename = 'upload/orig/CID_553.jpg';
$filesize = (filesize($filename) / 1024);
echo "filesize is $filesize Kb<br>";
$img_pointer = imagecreatefromjpeg($filename);
运行它时,我得到这个输出
mem: 0.30711364746094Mb
max is 64M
filesize is 952.2666015625 Kb
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 13056 bytes) in C:\temp_checkmem.php on line 13
加载 952Kb 的文件怎么可能使 PHP (imagecreatefrompeg) 超出允许的 64Mb 内存?有任何想法吗?