【发布时间】:2014-12-02 22:05:36
【问题描述】:
我想使用 PHP 以 xls 格式导出数据。但不是下载信息,而是显示在我的网页中。
//connection to database
//building of all information -> ($righe)
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: esporta_utenti.xls");
print $righe;
exit();
$righe 是我的元组
【问题讨论】:
-
跟随正确的标题
header('Content-Disposition: attachment; filename="esporta_utenti.xls"'); -
它不起作用,脚本的行为方式相同
-
你可以在
header()之前输出一些东西。注释header之前的所有代码,你会做对的。 -
对不起@JithinJose 但我不明白你在说什么。如果我在 header() 之前注释所有代码 $righe 将为空