读取大文件添加至数据库,系统error_log()方法内存溢出

浏览:887 发布日期:2016/01/29 分类:求助交流 关键字: 系统导致错误
在解决大文件读取以后,我要将文件每一行循环写入数据库,小文件则顺利通过,大文件会报“Allowed memory size of 134217728 bytes exhausted (tried to allocate 4448289 bytes) in /ThinkPHP/Library/Think/Log/Driver/File.class.php on line 46”错误。
找到File.class.php,并注释掉46行“error_log("[{$now}] ".$_SERVER['REMOTE_ADDR'].' '.$_SERVER['REQUEST_URI']."\r\n{$log}\r\n", 3,$destination);”后,程序正常,大小文件均可通过

$col_count = count($cell_title);
for($row = 2; $row <= $row_num; $row++) {
$date = array();
for($col = 0; $col < $col_count; $col++) {
$value = $currentSheet->getCellByColumnAndRow($col, $row)->getFormattedValue();
$date[$cell_title[$col]] = $value;
}
M($dbname)->add($date); //这一行出错
unset($date);
}

是否是thinkphp 日志记录有问题???
最佳答案
评论() 相关
后面还有条评论,点击查看>>