abstract:{load href="/static/bootstrap/css/bootstrap.css"}<div class="container"> <div class="row"> <h3 class="text-center">員工信息登記表</h3> <di
{load href="/static/bootstrap/css/bootstrap.css"} <div class="container"> <div class="row"> <h3 class="text-center">員工信息登記表</h3> <div class="col-md-8 col-md-offset-2"> <table class="table table-bordered table-hover text-center"> <tr class="info"> <td>ID</td> <td>姓名</td> <td>性別</td> <td>年齡</td> <td>工資</td> </tr> {volist name="staffs" id="staff" } <tr><td>{$staff.staff_id}</td> <td>{$staff.name}</td> <td>{$staff.sex}</td> <td>{//$staff.age} {in name="staff.sex" value="0,1"} {if $staff.sex == 0} 男 {else /} 女 {/if} {/in} </td> <td>{$staff.salary}</td> </tr> {/volist} </table> <div class="text-center">{$page|raw}</div> </div> </div> </div> {load href="/static/jquery/jquery-3.2.1.min.js"} {load href="/static/bootstrap/js/bootstrap.js"} <?php namespace app\index\controller; use think\Controller; use app\index\model\Staff as StaffModel; class Staff extends Controller { //循環(huán)標(biāo)簽 public function demo1() { $staffs = StaffModel::all(function($query){ $query->field(['staff_id','name,sex','age','salary']); // ->where('salary','<',100); }); $this->view->assign('staffs',$staffs); return $this->view->fetch(); } public function demo2() { //分頁(yè)配置 $config = [ 'type' =>'bootstrap', 'var_page' =>'page' ]; $num =3; $simple =false; $paginate = StaffModel::paginate($num,$simple,$config); $page = $paginate->render(); $this->view->assign('staffs',$paginate); $this->view->assign('page',$page); return $this->view->fetch(); } }
Correcting teacher:查無(wú)此人Correction time:2019-01-15 09:59:24
Teacher's summary:嗯,完成的不錯(cuò)。代碼要縮進(jìn),多加點(diǎn)注釋。。繼續(xù)加油。