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