PHP using Excelfileparser to import Excel into the database _php tutorial

Source: Internet
Author: User
This is a practical PHP tutorial using Excelfileparser to import Excel into the database tutorial Oh.





Excel Data Capture Demo





Excel Data Capture Demo





parese.php file

/**
* Copyright (c) 2009,
* All rights reserved.
FileName
Summary
*
* @author Week VIII [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 for "Application/vnd.ms-excel"
* ["tmp_name"] + = Temp file name
* ["error"] = + Error (0 Success 1 file too large more than Upload_max_filesize2 file is too large for max_file3 upload incomplete 4 not uploaded file)
* ["size"] + = File size (in 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, prevents illegal submissions, and is usually used 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 not lawful ');
}
Processing
if (0 = = $return [0])
{
Import (' @.util.excelparser ');
$excel =new excelparser ($_files[' Excel ' [' Tmp_name ']);
$return = $excel->main ();
}
Output processing
Print_r ($return);
?>

http://www.bkjia.com/PHPjc/630810.html www.bkjia.com true http://www.bkjia.com/PHPjc/630810.html techarticle This is a practical PHP tutorial using Excelfileparser to import Excel into the database tutorial Oh.!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.