diff --git a/application/renshi/controller/Myexcel.php b/application/renshi/controller/Myexcel.php index c6fea2e6..4f52f6a2 100644 --- a/application/renshi/controller/Myexcel.php +++ b/application/renshi/controller/Myexcel.php @@ -10,11 +10,9 @@ use PhpOffice\PhpSpreadsheet\IOFactory; class Myexcel { - // 读取电子表格 - public function readExcel($filename = '/public/upload/Book1.xls') - { + /**读取数据**/ + public function readXls($filename){ $path = $filename; - dump($path); setlocale(LC_ALL, 'zh_CN'); //csv中文乱码 $inputFileType = IOFactory::identify($path); $excelReader = IOFactory::createReader($inputFileType); @@ -29,6 +27,7 @@ class Myexcel } + // 生成电子表格 public function outExcel() { diff --git a/application/renshi/controller/Student.php b/application/renshi/controller/Student.php index 802d5bf1..0a461a5d 100644 --- a/application/renshi/controller/Student.php +++ b/application/renshi/controller/Student.php @@ -250,9 +250,9 @@ class Student extends Base $excel = new Myexcel(); // 读取表格数据 - $stuinfo = $excel->readExcel($list['url']); + $stuinfo = $excel->readXls($list['url']); - dump($stuinfo) + dump($stuinfo); @@ -272,7 +272,7 @@ class Student extends Base // 获取表单上传文件 例如上传了001.jpg $file = request()->file('file'); // 移动到框架应用根目录/uploads/ 目录下 - $info = $file->move( '..\uploads\teacher'); + $info = $file->move( '..\uploads\student'); if($info){ // 成功上传后 获取上传信息 $list['category'] = $info->getExtension(); @@ -282,7 +282,7 @@ class Student extends Base //将文件信息保存 $data = Fields::create($list); - $data ? $data = array('msg'=>'上传成功','val'=>true,'url'=>'..\uploads\teacher\\'.$list['url']) : $data = array('msg'=>'保存文件信息失败','val'=>false,'url'=>null); + $data ? $data = array('msg'=>'上传成功','val'=>true,'url'=>'..\uploads\student\\'.$list['url']) : $data = array('msg'=>'保存文件信息失败','val'=>false,'url'=>null); }else{ // 上传失败获取错误信息 $data = array('msg'=>$file->getError(),'val'=>false,'url'=>null); diff --git a/application/renshi/view/student/create_all.html b/application/renshi/view/student/create_all.html index 53d6803e..d137dbbe 100644 --- a/application/renshi/view/student/create_all.html +++ b/application/renshi/view/student/create_all.html @@ -21,7 +21,7 @@ -