abstrait:<?php /** * Created by PhpStorm. * User: 普通用戶 * Date: 2019/6/18 * Time: 22:27 */ namespace app\index\controller; use
<?php /** * Created by PhpStorm. * User: 普通用戶 * Date: 2019/6/18 * Time: 22:27 */ namespace app\index\controller; use think\Controller; use app\index\model\User as UserModel; class User extends Controller { public function instance(UserModel $user) { dump($user->get(1)); } public function demo1() { $user = UserModel::all(function($query){ $query->field(['uid','name','phone','country','birthday','weight','height','add_time']); }); $this->view->assign('user',$user); return $this->view->fetch(); } public function page() { $num = 6; $isimple = false; $config=[ 'type'=>'bootstrap', 'var_page'=>'page' ]; $user = UserModel::paginate($num,$isimple,$config); $page=$user->render(); $this->view->assign('user',$user); $this->view->assign('page',$page); return $this->view->fetch(); } }
{load href="/static/bootstrap/css/bootstrap.css"/} <div class="content"> <div class="row"> <h2 class="text-center">人員信息登記表</h2> <div class="col-md-8 col-md-offset-2"> <table class="table table-bordered table-hover text-center"> <tr> <td>工號(hào)</td> <td>姓名</td> <td>聯(lián)系電話</td> <td>國籍</td> <td>生日</td> <td>體重</td> <td>身高</td> <td>入職日期</td> </tr> {volist name="user" id="use"} <tr> <td>{$use.uid}</td> <td>{$use.name}</td> <td>{$use.phone}</td> <td>{$use.country}</td> <td>{$use.birthday}</td> <td>{$use.weight}</td> <td>{$use.height}</td> <td>{$use.add_time}</td> </tr> {/volist} </table> <div class="text-center">{$page|raw}</div> </div> </div> </div> {load href="/static/jquery/jquery.js"} {load href="/static/bootstrap/js/bootstrap.min.js"}
經(jīng)過相近一個(gè)月時(shí)間學(xué)習(xí)本章tp5.1基礎(chǔ)對(duì)tp5.1基本的mvc操作有了初步掌握,后續(xù)再不斷深入學(xué)習(xí)提升,爭取運(yùn)用到工作項(xiàng)目中
Professeur correcteur:天蓬老師Temps de correction:2019-06-28 09:27:23
Résumé du professeur:寫得不錯(cuò), 是不是很有成就感呢, 其實(shí)編程并不難的....