html と php を使用して xls ファイルを生成しましたが、問題ありません。しかし、問題は、ファイルを開こうとすると、次のエラーが表示されることです
私のコードはここにあります:
$filename = "file.xls";
header("Content-Type: application/vnd.ms-excel; charset=utf-8");
header("Content-type: application/x-msexcel; charset=utf-8");
header("Content-Disposition: attachment;filename=".$filename); //tell browser what's the file name
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: max-age=0");
echo '<table>
<tr>
<th>heading1</th>
<th>heading2</th>
<th>heading3</th>
</tr>
<tr>
<td>data1</td>
<td>data2</td>
<td>data3</td>
</tr>
</table>';