phpexcel 遇到的2个问题及解决方法

今天用phpexcel做导出的时候遇到2个问题,一是eregi函数 在5.3以后的版本 deprecated 查了下翻译 意思是废除了 

没办法只能 preg_match 代替。

if(!function_exists('eregi'))
{
	function eregi($pattern,$string,$regs=array())
	{
		return preg_match('/'.$pattern.'/i',$string,$regs);
	}
}

第一时间想到的是 用上面的方法重定义下函数,悲剧的是 deprecated了 但php -r "var_dump(function_exists('eregi'));"; 结果是true 只能一个一个替换

这个问题Ok后,又出现了

open_basedir restriction in effect. File() is not within the allowed path(s): (./:/tmp:/www:../)

Uncaught exception 'Exception' with message 'Can't create temporary file' in /phpexcel/PHPExcel/Shared/OLE/OLE_File.php

修改了 OLE_File.php里面  $this->_tmp_dir = '/tmp/'; 然后搞定。

posted on 2011-03-11 12:36  andychia  阅读(443)  评论(0)    收藏  举报

导航