dedecms织梦后台增加批量上传和导出报表的功能(2)

                                        );  

                                    fputcsv($output, $arrkeys);  

                                }  

       

                        fclose($output) or die("can't close ");  

                        exit();  

    ?>  


2、导入xls文件

查看源码

 

打印代码帮助

    <?php  

               require_once (dirname(__FILE__) . "/../include/common.inc.php");  

               include_once("excel/reader.php");  

                     $tmp = $_FILES['file']['tmp_name'];  

                     if (empty ($tmp)) {  

                           ShowMsg("请选择要导入的Excel文件!","test.php");  

                             exit;  

                     }  

       

                     $save_path = "xls/";  

                     $file_name = $save_path.date('Ymdhis') . ".xls";  

                     if (copy($tmp, $file_name)) {  

                             $xls = new Spreadsheet_Excel_Reader();  

                             $xls->setOutputEncoding('utf-8');  

                             $xls->read($file_name);  

                             for ($i=2; $i<=$xls->sheets[0]['numRows']; $i++) {  

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/ed4d974c0141d279cd0506656420436a.html