5
我在使用this tutorial来读取xlsx
文件格式。我正在阅读xlsx文件。工作正常。但它将所有文件内容显示在一行中。如何在它们之间添加空间?谢谢 这是我的代码。使用PHP读取xlsx文件
$file_upload = 'book.zip';
$zip = new ZipArchive;
// the string variable that will hold the file content
$file_content = " ";
// the uploaded file
//$file_upload = $file -> upload["tmp_name"];
if ($zip -> open($file_upload) === true) {
// loop through all slide#.xml files
if (($index = $zip -> locateName("xl/sharedStrings.xml")) !== false) {
$data = $zip -> getFromIndex($index);
$xml = DOMDocument::loadXML($data, LIBXML_NOENT | LIBXML_XINCLUDE | LIBXML_NOERROR | LIBXML_NOWARNING);
$file_content = strip_tags($xml -> saveXML());
}
echo $file_content;
}