phpexcel导出excel的两个问题
notice: iconv_strlen() [function.iconv-strlen]: detected an illegal character in input string in e:\test\phpnow-1.5.6\vhosts\127.0.0.18\inc\phpexcel\phpexcel\shared\string.php on line 554
fatal error: allowed memory size of 134217728 bytes exhausted (tried to allocate 16 bytes) in e:\test\phpnow-1.5.6\vhosts\127.0.0.18\inc\phpexcel\phpexcel\cell.php on line 840
本地调试的时候出现的,请问该怎么解决呢? phpexcel默认导出的编码是什么呢?数据库的编码是gbk的。
源代码有500多行(菜鸟phper)就不贴了。
针对第二个问题在网上找了下,加了这两句还是没用
set_time_limit(900);
//设置最大内存为128m
@ini_set('memory_limit','128m');
在这里先谢谢大家了
------解决方案--------------------
問題1:
mb_convert_encoding($html,'utf8','big5'); //將big5轉為utf8
或iconv(gb2312,utf-8,$要转的string);
問題2:
你的內存不足,需要修改php.ini中允許使用的內存量,改完重啟apache
------解决方案--------------------
第二个问题: 内存超出
解决办法一:
可以通过以下两个方法修改php运行时的内存限制.
在php.ini文件里设置memory_limit = 12m(推荐使用,如果拥有这个权限的话)
?在sites/default/settings.php文件里设置ini_set('memory_limit','12m');
解决办法二:
// 设置缓存方式,减少对内存的占用
$cachemethod = phpexcel_cachedobjectstoragefactory::cache_to_phptemp;
$cachesettings = array (
'cachetime' => 300
);
phpexcel_settings::setcachestoragemethod ( $cachemethod, $cachesettings );
