700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > php过滤excel文件 phpexcel读取excel内存释放怎么处理

php过滤excel文件 phpexcel读取excel内存释放怎么处理

时间:2023-03-05 07:59:50

相关推荐

php过滤excel文件 phpexcel读取excel内存释放怎么处理

php使用phpexcel读取excel的时候,如果excel本身行列较多,很容易引起

Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes)

内存不够的报错,

于是我写了一段脚本,利用phpexcel过滤器实现块级读取,但是每次读取完毕了,占用的内存不会释放掉,造成多次读取以后还是会报出Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes)内存不够的错误?

使用unset,=null都没有明显的作用,后面查了下资料,

在PHPExcel_Worksheet和phpexcel类中加了Desroty方法,并且显式调用也没有用

public function Destroy() {

foreach($this->_cellCollection as $index => $dummy) {

$this->_cellCollection[$index] = null;

}

$this->_cellCollection = null;

}

public function Destroy() {

foreach($this->_workSheetCollection as $index => $dummy) {

$this->_workSheetCollection[$index]->Destroy();

$this->_workSheetCollection[$index] = null;

}

$this->_workSheetCollection = null;

}

请问哪位大佬有解决方案啊?

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。