Recently, I was working on a school project. the project had a requirement to dynamically retrieve data from the database to generate Excel documents in the corresponding format, for this reason, I went to the Internet to search for the corresponding PHP EXcel document code or class library, and found that PHPExcel is an Excel operation written by a foreign organization.
Recently, I was working on a school project. the project had a requirement to dynamically retrieve data from the database to generate Excel documents in the corresponding format, for this reason, I went to the Internet to search for the corresponding PHP EXcel document code or class libraries. I found that the third-party class libraries used to operate Excel documents written by PHPExcel are powerful and easy to use, however, there are two problems:
First, the instruction documents for this class library are all in English.
Second, the case that PHPExcel is used in the thinkphp framework cannot be found on the Internet.
What should I do? Don't think about it.
Because the usage of the class library is basically the same, it is nothing more than importing it into the class to be used.
After importing, you can use the features encapsulated in it. For more information, see http://baike.baidu.com/view/3462519.htm.
The following describes how to import PHPExcel in thinkphp.
Step 1Download the PHP Excel class library package online. decompress the package and you will see the subdirectory:
Open the Classes directory and you will see a PHPExcel. php file. rename this file PHPExcel. class. php.
Step 2Put the entire directory under the ORG directory of the project. the directory structure is as follows:
Step 3Import the PHPExcel class in Action using the import method of thinkphp
Import ('@. ORG. PHPExcel. Classes. PHPExcel'); in this way, you can use the Excel document operations method provided by the PHP Excel class library.