的134217728个字节phpexcel允许的内存大小耗尽 [英] phpexcel Allowed memory size of 134217728 bytes exhausted

查看:1334
本文介绍了的134217728个字节phpexcel允许的内存大小耗尽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用phpexcel写一个相当大的Excel文件。

I am using phpexcel to write quite a large excel file.

我从一个数组,看起来像

I am writing it from an array that looks like

array(
  [0] => stdClass Object
        (
            [sent] => Mar 31st, 2011 02:10PM
            [to_number] => 64211111111
            [additional_txt] => 
            [misc_data] => 
        )
  ...
  [14058] => stdClass Object
        (
            [sent] => Mar 31st, 2011 02:10PM
            [to_number] => 64211111111
            [additional_txt] => 
            [misc_data] => 
        )
)

该循环

$r = 0;
foreach ($replies_obj as $row) {
  $c = 'A';
  foreach ($row as $col)
    $xlsx->getActiveSheet()->setCellValue($c++ . $r, $col);
  $r++;
}

和误差

致命错误:允许内存大小
  134217728字节用尽(试图
  分配105字节)
  /home/webspace/xxxx/test/htdocs/application/libraries/PHPExcel/Worksheet.php
  线961

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 105 bytes) in /home/webspace/xxxx/test/htdocs/application/libraries/PHPExcel/Worksheet.php on line 961

这是一个phpexcel问题还是我做错了什么?

Is this a phpexcel problem or am I doing something wrong?

我该如何解决这个问题?

How can I fix this?

推荐答案

有很多都写了PHPExcel和内存的使用,我不打算在这里重复了这一切。

There's a lot been written about PHPExcel and memory use, and I'm not going to repeat it all here.

尝试读一些关于PHPExcel讨论板线程的讨论这个问题,比如这个;或previous答案在这里SO如这个或<一个href=\"http://stackoverflow.com/questions/4817651/phpexcel-runs-out-of-256-512-and-also-1024mb-of-ram\">this 之一

Try reading some of the threads on the PHPExcel discussion board discussing the issue, such as this one; or previous answers here on SO such as this one or this one

这篇关于的134217728个字节phpexcel允许的内存大小耗尽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆