lang->line('report_guest_statistics');header("Content-type: application/vnd.ms-"/> lang->line('report_guest_statistics');header("Content-type: application/vnd.ms-">

Home  >  Article  >  Backend Development  >  PHP导出表格时制表符没用

PHP导出表格时制表符没用

WBOY
WBOYOriginal
2016-06-13 10:33:411295browse

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 及以下版本

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn