使用OLEDB可以对excel文件进行读取,我们只要把该excel文件作为数据源即可 首先引用Microsoft.EXEL 代码如下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms
错误信息:UnicodeEncodeError: 'latin-1' codec can't encode character '\u5c0f' in position 31: Body ('小') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8的错误 原因:从excel中读取你的接口请求数据时带有中文时在发送求情时会出现上述错误.只需要将请求数据转化为bytes类型即可
直接上函数吧 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'=>