php利用ExcelFileParser把excel匯入資料庫_PHP教程

來源:互聯網
上載者:User
這是一款實用的php教程利用excelfileparser把excel匯入資料庫教程哦。





excel資料擷取示範





excel資料擷取示範





parese.php檔案

/**
* copyright (c) 2009,
* all rights reserved.
* 檔案名稱:
* 摘 要:
*
* @author 星期八 [url=mailto:ixqbar@hotmail.com]ixqbar@hotmail.com[/url]
* @version
*/

public function parse()
{
/**
* $_files數組說明
* array(n) {
* ["表單檔案框名稱"] => array(5) {
* ["name"] => 提交檔案名稱
* ["type"] => 提交檔案類型 excel為"application/vnd.ms-excel"
* ["tmp_name"] => 臨時檔案名稱
* ["error"] => 錯誤(0成功1檔案太大超過upload_max_filesize2檔案太大超過max_file3上傳不完整4沒有上傳檔案)
* ["size"] => 檔案大小(單位:kb)
* }
* }
*/
$return=array(0,'');
/**
* 判斷是否提交
* is_uploaded_file(檔案名稱)用於確定指定的檔案是否使用post方法上傳,防止非法提交,通常和move_upload_file一起使用儲存上傳檔案到指定的路徑
*/
if(!isset($_files) || !is_uploaded_file($_files['excel']['tmp_name']))
{
$return=array(1,'提交不合法');
}
//處理
if(0 == $return[0])
{
import('@.util.excelparser');
$excel=new excelparser($_files['excel']['tmp_name']);
$return=$excel->main();
}
//輸出處理
print_r($return);
?>

http://www.bkjia.com/PHPjc/630810.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/630810.htmlTechArticle這是一款實用的php教程利用excelfileparser把excel匯入資料庫教程哦。 !doctype html public -//w3c//dtd xhtml 1.0 transitional//en http://www.w3.org/tr/xhtml1/dtd/x...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.