|
laravel中使用PhpSpreadsheet对excel导入报错:Object of class PHPExcel_RichText could not be converted to int
原因是单元格中混杂了格式化的文本,string类型和richText类型混杂在一起,richeText类型要使用getPlainText()方法取内容.
if(gettype($cell)=='string'){//多数情况是string return $cell; }else if(gettype($cell)=='object'){//偶尔数据格式不一样
//info(get_class($cell);//这里根据反射可以调试具体对象类型 return $cell->getPlainText(); }
https://stackoverflow.com/questions/27439150/object-of-class-phpexcel-richtext-could-not-be-converted-to-int |