Questions about PHP Excel

Source: Internet
Author: User
Tags php excel
Questions about PHP Excel
Excel templates
A B C D
1 Name Sex Age entry Time
2
3
..

There are table people fields in SQL Name/sex/age/time

Can the contents of the SQL table be written to Excel based on the results of my query in the PHP language?

Like in PHP with tabular $row[] output similar to the results

What do you need to learn? Are there some more detailed examples?

------Solution--------------------
Why bother so much? Using headers to set the header information can be achieved simple Excel. Look at the first method in the connection I sent.
------Solution--------------------
Top, write the CSV format on the line, Jordan is actually the CSV format.

PHP Code
  
------Solution--------------------
Your way is too troublesome, and the difficulty of maintenance is too big.
Recommend me a common method, using the header to achieve

Start with the report style you need to export, create a new Excel, save it, save it in XML 2003 format, save it, open it with Notepad, and then organize the data in the same way you organize the page.

Then use the following code:
PHP code
header ("Content-type:application/vnd.ms-excel"); Header ("content-disposition:attachment; Filename= $filename "); Echo $excel _content; 
------Solution--------------------
1: First comment out the header section, output to the page to see if it is normal.
2: Delete those HTML tags in your code.
------Solution--------------------
To change the encoding when you view Excel.
------Solution--------------------
Explore

This is not difficult, phpexcel this class can help you do it.
Official Online example
  • 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.