当我尝试在 PHPExcel 脚本中上传 temp.xlsx 时,它将返回一个错误,例如 Fatal error: Class 'PHPExcel_Shared_String' not found in /home/demo/public_html/include/Classes/PHPExcel/Autoloader.php on line 36 on my server。但是当我在我的本地主机中运行相同的 PHPExcel 脚本时
<?php
require_once('Classes/PHPExcel.php');
require_once('Classes/PHPExcel/IOFactory.php');
//Usage:
convertXLStoCSV('input.xlsx','output.csv');
function convertXLStoCSV($infile,$outfile)
{
$fileType = PHPExcel_IOFactory::identify($infile);
$objReader = PHPExcel_IOFactory::createReader($fileType);
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load($infile);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV');
$objWriter->save($outfile);
}
?>
然后它将正常工作。我已经尝试通过网络更改文件夹的权限,但它无法正常工作。