PHP fwrite";。xlsx格式或扩展名无效";本地服务器
我正在尝试将数据写入excel文件。我执行代码,但是当我尝试打开excel文件时,我得到一个错误,表明格式或扩展名无效。这是我第一次在PHP上使用excel文件 这是我的密码:PHP fwrite";。xlsx格式或扩展名无效";本地服务器,php,excel,fwrite,Php,Excel,Fwrite,我正在尝试将数据写入excel文件。我执行代码,但是当我尝试打开excel文件时,我得到一个错误,表明格式或扩展名无效。这是我第一次在PHP上使用excel文件 这是我的密码: $e = fopen("Test.xlsx", "w"); fwrite($e, $balances['XVG']['onOrder']); fclose($e); Excel 2013版本: 有人知道会出什么问题吗?谢谢。您可以使用PHPExcel: 您还可以使用Microsoft的Excel XML格式: 要
$e = fopen("Test.xlsx", "w");
fwrite($e, $balances['XVG']['onOrder']);
fclose($e);
Excel 2013版本:
有人知道会出什么问题吗?谢谢。您可以使用PHPExcel:
您还可以使用Microsoft的Excel XML格式:
要创建带有标题的单行电子表格,您需要将以下XML写入文件:
$xml = <<<END_XML_ZZ
<?xml version="1.0" encoding="UTF-8"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">
<Worksheet ss:Name="CognaLearn+Intedashboard">
<Table>
<Column ss:Index="1" ss:AutoFitWidth="0" ss:Width="110"/>
<Row>
<Cell><Data ss:Type="String">ID</Data></Cell>
<Cell><Data ss:Type="String">Project</Data></Cell>
<Cell><Data ss:Type="String">Reporter</Data></Cell>
<Cell><Data ss:Type="String">Assigned To</Data></Cell>
<Cell><Data ss:Type="String">Priority</Data></Cell>
<Cell><Data ss:Type="String">Severity</Data></Cell>
<Cell><Data ss:Type="String">Reproducibility</Data></Cell>
<Cell><Data ss:Type="String">Product Version</Data></Cell>
<Cell><Data ss:Type="String">Category</Data></Cell>
<Cell><Data ss:Type="String">Date Submitted</Data></Cell>
<Cell><Data ss:Type="String">OS</Data></Cell>
<Cell><Data ss:Type="String">OS Version</Data></Cell>
<Cell><Data ss:Type="String">Platform</Data></Cell>
<Cell><Data ss:Type="String">View Status</Data></Cell>
<Cell><Data ss:Type="String">Updated</Data></Cell>
<Cell><Data ss:Type="String">Summary</Data></Cell>
<Cell><Data ss:Type="String">Status</Data></Cell>
<Cell><Data ss:Type="String">Resolution</Data></Cell>
<Cell><Data ss:Type="String">Fixed in Version</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="Number">0000033</Data></Cell>
<Cell><Data ss:Type="String">CognaLearn Intedashboard</Data></Cell>
<Cell><Data ss:Type="String">janardhana.l</Data></Cell>
<Cell><Data ss:Type="String"></Data></Cell>
<Cell><Data ss:Type="String">normal</Data></Cell>
<Cell><Data ss:Type="String">text</Data></Cell>
<Cell><Data ss:Type="String">always</Data></Cell>
<Cell><Data ss:Type="String"></Data></Cell>
<Cell><Data ss:Type="String">GUI</Data></Cell>
<Cell><Data ss:Type="String">2016-10-14</Data></Cell>
<Cell><Data ss:Type="String"></Data></Cell>
<Cell><Data ss:Type="String"></Data></Cell>
<Cell><Data ss:Type="String"></Data></Cell>
<Cell><Data ss:Type="String">public</Data></Cell>
<Cell><Data ss:Type="String">2016-10-14</Data></Cell>
<Cell><Data ss:Type="String">IE8 browser_Modules screen tool tip text is shown twice</Data></Cell>
<Cell><Data ss:Type="String">new</Data></Cell>
<Cell><Data ss:Type="String">open</Data></Cell>
<Cell><Data ss:Type="String"></Data></Cell>
</Row>
</Table>
</Worksheet>
</Workbook>
END_XML_ZZ;
$e = fopen("Test.xlsx", "w");
fwrite($e, $xml);
fclose($e);
$xml=我不想使用PHPExcel库的可能副本…xlsx是一种非常复杂的格式。这不仅仅是纯文本。也许CSV格式更适合您您您不必使用PHPExcel-您可以编写XML->您能为我提供一个使用Excel XML格式的简单示例吗?我真诚地感谢你