Php uses ExcelFileParser to import excel to database _ PHP Tutorial

Source: Internet
Author: User
Tags import database
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...

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.