使用DolphinPHP的框架中的excel插件导入数据

直接上函数吧

 public function importfile()
    {
                   
        if ($this->request->isPost()) {
 
            if($_POST['files']) {
                 CustomerDataModel::where('id','>',0)->delete();
                
                $info=Db::name('admin_attachment')->find($_POST['files']);     
                 
                $fields=array('name'=>'名称','count'=>'申请量');
                $result=plugin_action('Excel/Excel/import', [$info['path'],$table='customer_data',$fields,1,$where=array(),'name']);
                $this->success($result['message'], 'applyinfo');
            }
            exit;
        } else {
            return ZBuilder::make('form')
            ->addFormItem('file', 'files', '附件')
            ->isAjax(false)
            ->fetch();
        }
    }
原文地址:https://www.cnblogs.com/baker95935/p/10428083.html