Php uses ExcelFileParser to import excel files to the database. This is a practical php Tutorial. use excelfileparser to import excel to the database .! Doctypehtmlpublic-w3cdtdxhtml1.0transitionalenwww.w3.orgtrxhtml1dtdx this is a practical php Tutorial using excelfileparser excel import database tutorial Oh.
Excel data acquisition demonstration
Excel data acquisition demonstration
Parese. php file
/**
* Copyright (c) 2009,
* All rights reserved.
* File name:
* Abstract:
*
* @ Author route 8 [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"] => name of the submitted file
* ["Type"] => The submitted file type is "application/vnd. ms-excel"
* ["Tmp_name"] => temporary file name
* ["Error"] => error (0 Success 1. the file size exceeds the value of upload_max_filesize2. the file size exceeds that of max_file3. the file size is incomplete. 4. the file is not 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 unauthorized 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, 'illegal submission ');
}
// Process
If (0 = $ return [0])
{
Import ('@. util. excelparser ');
$ Excel = new excelparser ($ _ files ['Excel '] ['tmp _ name']);
$ Return = $ excel-> main ();
}
// Output processing
Print_r ($ return );
?>
Bytes. ! Doctype html public-// w3c // dtd xhtml 1.0 transitional // en http://www.w3.org/tr/xhtml1/dtd/x...