一、第一种
$objWriter = \PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
把上边的Excel2007改成Excel5
$objWriter = \PHPExcel_IOFactory::createWriter($excel, 'Excel5');
二、第二种
找到这个方法
\phpexcel\PHPExcel\Calculation\Functions.php
去掉575行的break,如下所示,return 64;下边的break。
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 errorif (self::isCellValue($a)) {return 16;} elseif (self::isMatrixValue($a)) {return 64;}} elseif(empty($value)) {//Empty Cellreturn 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)) {//Errorsif ((strlen($value) > 0) && ($value{0} == '#')) {return 16;}return 2;}return 0;}
以上基本就能解决,这种情况多发生于项目运行环境发生变更
来源地址:https://blog.csdn.net/qq_38921838/article/details/128453361