CI框架在CLI下执行占用内存过大问题的解决方法_php实例

WBOY
Release: 2016-06-07 17:18:53
Original
837 people have browsed it

很多程序员在使用codeigniter CLI下执行一个大批量数据导入的问题时,会一直出现内存过高的情况,下面对此分析器原因及解决办法。

CI db会将所有的查询sql和和sql执行时间保存下来,对于类似百万级大数据量的导入问题来说,其执行的sql记录都会被保存在内容中,这就占用了大量的内容直至脚本结束。

解决办法:
当你执行大数量的db操作时,记得设置:

复制代码 代码如下:

$this->db->save_queries = FALSE;
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template