It is useless to export a table using PHP.

Source: Internet
Author: User
When exporting a report in PHP, the tab character is useless. recently, the report must be exported to an excel file, but the & quot; \ t & quot; in the PHP code is useless. the PHP code is as follows $ filename = $ this-& gt; lang-& gt; line ('report _ guest_statistics '); header (& quo PHP does not use tabs when exporting reports
Recently, when preparing a report, you need to export an excel file, but "\ t" in the PHP code is useless.
The PHP code is as follows:
$ 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;

The result is as follows:


What I want is | total number of members | number of members with orders | total number of member orders | member purchase rate |
| 4 | 4 | 4 | 75.00 |

As a result, the data in each row is in the same row, that is, the "\ t" of the above code does not work. please handle the error. thank you.


------ Solution --------------------
This method is only applicable to excel2003 and earlier versions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.