我有这个代码来制作excel文件
header( "Content-Type: application/vnd.ms-excel" );
header( "Content-disposition: attachment; filename=test.xls" );
echo "test".chr(14)."test"."\t"."test".'<br>';
echo "test"."\t"."test"."\t"."test".PHP_EOL;
echo "test"."\t"."test"."\t"."test".PHP_EOL;
echo "test"."\t"."test"."\t"."test"."\n";
此代码不会在Excel文件上创建标签或新行。它在实时服务器中工作,但在localhost中无法正常工作。我试过&#34; \ t&#34; ,chr(13),chr(14),PHP_EOL ,但它也不起作用。如果我使用** <br>
**,它将会成为新行
你能帮我解决这个问题吗?谢谢
答案 0 :(得分:0)
此标题后
header( "Content-disposition: attachment; filename=test.xls" );
尝试添加这些标题
header("Pragme: no-cache");
header("Expires: 0");