说是1762行有问题,找到这个文件的代码看看:
/** * get an instance of this class * * @access public * @param phpexcel $workbook injected workbook for working with a phpexcel object, * or null to create a standalone claculation engine * @return phpexcel_calculation */ public static function getinstance(phpexcel $workbook = null) { if ($workbook !== null) { if (isset(self::$_workbooksets[$workbook->getid()])) { return self::$_workbooksets[$workbook->getid()]; } return new phpexcel_calculation($workbook); } if (!isset(self::$_instance) || (self::$_instance === null)) { self::$_instance = new phpexcel_calculation(); } return self::$_instance; } // function getinstance()
这个函数getinstance(phpexcel $workbook = null)
发现这个函数 定义的时候多了个phpexcel ,我试着把它删除,上传,测试,又报错了:
这次是1721行,然后再次找到这个位置的文件删除 phpexcel这个东东,然后继续上传,测试,后面大多数错误都是这种,删掉函数定义时的phpexcel即可,但是错误一个接一个,这是需要替换的文件:
这个地方要加个空格,这样才不会替换错误,好了,继续上传测试.
然后就这样了…..当时内心是崩溃的…
继续找问题吧,在测试php文件里面输出变量进行测试。
phpexcel\phpexcel\calculation\functions.php 下面这个文件,中有个 **type**函数,将其中的break去掉,上传,ok了/** * type * * returns a number that identifies the type of a value * * @param value the value you want tested * @return number n converts values listed in the following table * if value is or refers to n returns * a number 1 * text 2 * logical value 4 * an error value 16 * array or matrix 64 */ public static function type($value = null) { $value = self::flattenarrayindexed($value); if (is_array($value) && (count($value) > 1)) { $a = array_keys($value); $a = array_pop($a); // range of cells is an error if (self::iscellvalue($a)) { return 16; // test for matrix } elseif (self::ismatrixvalue($a)) { return 64; } } elseif(empty($value)) { // empty cell return 1; } $value = self::flattensinglevalue($value); if (($value === null) || (is_float($value)) || (is_int($value))) { return 1; } elseif(is_bool($value)) { return 4; } elseif(is_array($value)) { return 64; break; } elseif(is_string($value)) { // errors if ((strlen($value) > 0) && ($value{0} == '#')) { return 16; } return 2; } return 0; } // function type()
这是完整流程,线上系统用的是centos7,php是也是7。这个估计是不兼容造成的,也没有再深一步研究了,毕竟其实有新的excel插件了,要不是,有太多代码需要修改,估计我直接换插件了。
相关推荐:
tp3.2中phpexcel导入excel方法分享
php使用phpexcel批量上传到数据库
thinkphp+phpexcel实现excel报表输出功能实例详解
以上就是phpexcel在linux系统报错如何解决的详细内容。