lang->line('report_guest_statistics');header("Content-type: application/vnd.ms-"/> lang->line('report_guest_statistics');header("Content-type: application/vnd.ms-">
PHP导出报表时制表符没用
最近在做报表,需要导出excel格式的文件,可是PHP代码里面的"\t"没用.
PHP代码如下
$filename = $this->lang->line('report_guest_statistics');
header("Content-type: application/vnd.ms-excel; charset=utf-8");
header("Content-Disposition: attachment; filename=$filename.xls");
$data = $percent_buy_member."\t\n";
$data .= $member_count."\t" . $order_member_count."\t" .
$member_order_count."\t" . $percent_buy_member."\n";
echo $data."\t";
exit;
结果如如下所示
我想要的效果是|会员总数|有订单会员数|会员订单总数|会员购买率|
| 4 | 3 | 4 | 75.00 |
结果每行的数据都排在一行了,也就是上面代码的"\t"没有作用,请大神纠错,谢谢
------解决方案--------------------
这种写法只适合于 excel2003 及以下版本