1.先下载 导入excel类(我自己找的)
链接:https://pan.baidu.com/s/1eXkwUV1fI60yq0rSjokbSg 密码:2mo5
放入到think\vendor中
然后html代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<center>
<form action="addexcel" method="post" enctype="multipart/form-data">
选择文件:<input type="file" name="file">
<input type="submit" value="上传">
</form>
</center>
</body>
</html>
然后接收到excel表格的和处理、添加数据库的方法
public function addexcel()
{
vendor("PHPExcel.PHPExcel");