Home > Backend Development > PHP Tutorial > PHP uses ExcelFileParser to import excel into the database_PHP tutorial

PHP uses ExcelFileParser to import excel into the database_PHP tutorial

WBOY
Release: 2016-07-13 17:05:04
Original
1143 people have browsed it

This is a practical php tutorial to use excelfileparser to import excel into the database.





excel data acquisition demonstration





excel data acquisition demonstration









parese.php file

/**
* copyright (c) 2009,
* all rights reserved.
* File name:
* Summary:
*
* @author Saturday [url=mailto:ixqbar@hotmail.com]ixqbar@hotmail.com[/url]
* @version
*/

public function parse()
{
/**
* $_files array description
* array(n) {
* ["Form file box name"] => array(5) {
* ["name"] => Submit file name
* ["type"] => Submit file type excel is "application/vnd.ms-excel"
* ["tmp_name"] => Temporary file name
* ["error"] => Error (0 successful 1 file too large exceeds upload_max_filesize 2 file too large exceeds max_file 3 upload incomplete 4 no file uploaded)
* ["size"] => File size (unit: kb)
* }
* }
*/
$return=array(0,'');
/**
* Determine whether to submit
* is_uploaded_file (file name) is used to determine whether the specified file is uploaded using the post method to prevent illegal submission. It is usually used together with move_upload_file to save the uploaded file to the specified path
*/
if(!isset($_files) || !is_uploaded_file($_files['excel']['tmp_name']))
{
$return=array(1,'Submission is illegal');
}
//Process
if(0 == $return[0])
{
import('@.util.excelparser');
$excel=new excelparser($_files['excel']['tmp_name']);
$return=$excel->main();
}
//Output processing
print_r($return);
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630810.htmlTechArticleThis is a practical php tutorial to use excelfileparser to import excel into the database. !doctype html public -//w3c//dtd xhtml 1.0 transitional//en http://www.w3.org/tr/xhtml1/dtd/x...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template