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文件夾拷貝其中

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

8. 本節源碼下載,下載密碼:p4wp
[源碼下載](https://pan.baidu.com/s/16IbgJLBT4RSu2tf7vq_Rog)