我正在使用PHPExcel读取3个文件。其中2个为xls,1个为。我为这个任务创建了两个阅读器,但是遇到了错误。
HTTP Error 500.0 - Internal Server Error
C:\AppServ\php5\php-cgi.exe - The FastCGI process exited unexpectedly这是我的密码
$inputFileType = PHPExcel_IOFactory::identify($conPath);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($conPath);
$objReader = PHPExcel_IOFactory::createReader("Excel5");
$objPHPExcelShip = $objReader->load("Ship to mapping.xls");
$objPHPExcelMat = $objReader->load("Material Mapping.xls");$inputFileType是上传文件类型(即xlsx.)的变量。如果我上传xls,代码可以正常工作。但是,如果上传的文件是xlsx,请给出错误。
请帮帮忙。
发布于 2014-03-25 07:59:43
如果对每个读取器实例使用相同的变量,则不能这样做:您需要为实例化的每个阅读器使用一个单独的读取器实例:
$objReader1 = PHPExcel_IOFactory::createReader("Excel5");
$objPHPExcelShip = $objReader1->load("Ship to mapping.xls");
$objReader2 = PHPExcel_IOFactory::createReader("Excel5");
$objPHPExcelMat = $objReader2->load("Material Mapping.xls");或者(至少)在加载每个文件时为它实例化一个新读取器。
$objReader = PHPExcel_IOFactory::createReader("Excel5");
$objPHPExcelShip = $objReader->load("Ship to mapping.xls");
$objReader = PHPExcel_IOFactory::createReader("Excel5");
$objPHPExcelMat = $objReader->load("Material Mapping.xls");https://stackoverflow.com/questions/22625720
复制相似问题