1. 下载安装好thinkphp3
下载地址:http://www.thinkphp.cn/down/610.html
2. 下载bootstrap
下载地址:https://v3.bootcss.com/
3. 复制根目录下Application下的Home模块更改名字为Shop
4. 在Shop/Controller文件夹下创建AdminController.class.php,其代码展示为
~~~
<?php
namespace Shop\Controller;
use Think\Controller;
class AdminController extends Controller {
public function add(){
$this->display();
}
public function lists(){
$this->display();
}
}
~~~
5. 在根目录下的Public文件夹中创建bootstrap文件夹,并将下载的bootstrap中的css,js,fonts文件夹拷贝其中
![](https://box.kancloud.cn/116289add9cc79c0fb77a5f0dfc97c0d_717x344.png)
6. 在Shop/View文件夹下Admin文件夹,在其中放入add.html与list.html,其中add.html代码展示为
~~~
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<link href="__PUBLIC__/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="__PUBLIC__/bootstrap/js/html5shiv.min.js"></script>
<script src="__PUBLIC__/bootstrap/js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<form action="{:U('addgoods')}" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="exampleInputEmail1">商品名字</label>
<input name="name" type="text" class="form-control" >
</div>
<div class="form-group">
<label for="exampleInputPassword1">价格</label>
<input name="pirce" type="text" class="form-control" >
</div>
<div class="form-group">
<label for="exampleInputPassword1">规格</label>
<select class="form-control" name="pex">
<option value="A类">A类</option>
<option value="B类">B类</option>
<option value="C类">C类</option>
<option value="D类">D类</option>
<option value="F类">F类</option>
</select>
</div>
<div class="form-group">
<label for="exampleInputFile">图片</label>
<input type="file" name="img" id="exampleInputFile">
</div>
<button type="submit" class="btn btn-default">添加商品</button>
</form>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="__PUBLIC__/bootstrap/js/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="__PUBLIC__/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
~~~
7. 在浏览器输入:域名//index.php/shop/admin/add
![](https://box.kancloud.cn/ef3e8ac10615039aafe6cce3d2f852a3_1919x369.png)
8. 本节源码下载,下载密码:p4wp
[源码下载](https://pan.baidu.com/s/16IbgJLBT4RSu2tf7vq_Rog)