Importing Excel files using PHP

Source: Internet
Author: User

First go to the Internet to find code, using the first article on Baidu, it is sure that many are used by Daniel, website: http://www.jb51.net/article/26921.htm, download http://sourceforge.net/projects/ Phpexcelreader example;

Let the after decompression to the WWW directory, the first example of the package run successfully, and then slowly changed to their own needs.

Run example.php file to report a lot of errors;

1: Is the reader.php file in the Oleread.inc file introduction error, just directly introduced can:require_once ' oleread.inc ';

(Note:oleread.inc in the downloaded package there is no need to make any changes to the direct introduction , and no longer to change it to a file suffix PHP.) )

2: Modify the example.php file, here I only made a few changes: $data->setoutputencoding (UTF-8) in order to display in Chinese on the web normally,

Read Excel, read the Excel content, print the rows and columns on the web, and modify the Excel table appropriately to correspond to the fields in our database (also can be adjusted later in the SQL statement).

Will find the Excel form provided in the download package is not available at all , we need to create a new read (Note: The table can not be formatted with any )

If you have a file format in your data file, clear the:excel-> format first.

3: After the example.php file can be run successfully, and the content in Excel can be output on the web, and then create a new PHP to test.php file as an example to start debugging their own Excel.

4: Copy paste online Daniel's test.php files in the code, and then on their own slowly debugging it, as long as the assembly of the correct basic will not be the problem ( in the process of assembling data fields to correspond good ) and so on.

5:test.php files in the database connection code, file output encoding according to their own encoding.

Importing Excel files using PHP

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.