我将文件 csv 的值读取为:
//$mypath . '/' . $filename <=> ../abc.csv
$val = file_get_contents($mypath . '/' . $filename);
$escaped = pg_escape_bytea($val);
$model->addFileImport($tmp, $data['email'], $escaped);
我的文件大约 100MB。在 php.ini 设置中:memory_limit = 128M
但它仍然:Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 133120 bytes) in...
在行显示错误: $val = file_get_contents($mypath . '/' . $filename);
我已通过 add 修复 ini_set('memory_limit', '-1');
:
//$mypath . '/' . $filename <=> ../abc.csv
ini_set('memory_limit', '-1');
$val = file_get_contents($mypath . '/' . $filename);
$escaped = pg_escape_bytea($val);
$model->addFileImport($tmp, $data['email'], $escaped);
但它显示错误:
致命错误:第 112 行 C:\wamp\www\joomlandk\components\com_servicemanager\views\i0701\view.html.php 中的内存不足(已分配 230686720)(试图分配 657099991 字节)
在行$escaped = pg_escape_bytea($val);
为什么?如何修复该错误?