Thinkphp uses phpExcelReader to import an Excel table to a database

Source: Internet
Author: User
Provides various official and user-released code examples. For code reference, you are welcome to learn thinkphp. Use phpExcelReader to import an Excel table to the database.
You can use it as needed,
During the writing process, it was found that the add () where () and other functions provided by tp could not be written as native writing. If any great god knows what is going on, please do not know.
PhpExcelReader: http://sourceforge.net/projects/phpexcelreader/
// ====================================
For more information about phpExcelReader, see
1. the Excel/reader. php file already uses require_once to include the oleread. inc file. Therefore, you do not need to load oleread. inc during the call.
2. the Excel file jxlwtest.xls of the official website is damaged and cannot be read or parsed.
3. The 31st rows of the original Excel/reader. php file (as follows) may cause an error:
Require_once 'spreadsheet/Excel/Reader/OLERead. php ';
The reason is that the Spreadsheet/Excel/Reader/OLERead. php file does not exist. In fact, the file needed here is Excel/oleread. inc. Change the file name after require_once to 'oleread. inc.
4. The 261st rows of the original Excel/reader. php file cause the following warning:
Deprecated: Assigning thereturn value of new by reference is deprecated
The reason is that the = & symbol of this line has been deprecated in PHP 5.3. Based on the role of this symbol, you can directly change it to =.
5. PHP-ExcelReader does not support parsing Excel 2007 documents. That is to say, Excel files with the xlsx extension cannot be parsed using this class library. It only targets Excel files with the xls extension.
6. the PHP-ExcelReader encoding method is based on the iconv command. The parameter of setOutputEncoding is the name of the character set to be set. To make this method take effect, you need to install the iconv extension for the local PHP environment. If the local PHP environment does not have the iconv extension, the PHP-ExcelReader encoding method defaults to Unicode.
7. The PHP-ExceReader may have an error in precision when parsing integers. For example, the 58 Parsing is 57.5, And the cause is unknown. All you can do is check the data after parsing and rounding it out (if necessary ).
8. For blank cells in an excel file, PHP-ExcelReader either skips the blank cells that are not stored in the result array or saves them as 0 or "(empty string ).

Source code see: http://www.jakehu.me /? P = 109

AD: truly free, domain name + VM + enterprise mailbox = 0 RMB

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.