[英]How to check if an excel file has unreadable content in phpexcel
在我的Web应用程序中,我收到了许多用户的电子邮件,每个电子邮件都有excel附件2007。附件保存在服务器中,我需要通过PHPEXcelReader类解析每个电子邮件附件。 但是有些Excel附件的内容不可读,从而引发以下错误。 错误:ZipArchive :: getForName();无效或未使用的zip对象。
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objReader = setLoadSheetOnly('Sheet1');
$directory = "email_attachments";
$file_name = "attachment1.xlsx";
if(file_Exists($directory."/".$file_name))
{
// This following line is not executed, and throws the error.
$objPHPExcel = $objReader->load($directory."/".$file_name);
}
无法打开attachment1.xlsx,并警告该文件内容不可读。 如何解决这个问题?
请帮忙。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.