标签:测试 set info sel his table app val end
1.修改tp5/application/index/controller/Index.php内容。
1 <?php 2 namespace app\index\controller; 3 //引入系统数据类 4 use think\Db; 5 //引入系统控制器类 6 use think\Controller; 7 class Index extends Controller 8 { 9 public function index() 10 {12 //从数据库中读取数据 13 $data=Db::table(‘user_info‘)->select(); 14 //var_dump($data); 15 //分配数据给页面 16 $this->assign(‘data‘,$data); 17 //加载页面 18 return view(); 19 20 } 21 }
2.修改tp5/application/index/view/index/index.html页面内容。
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>无标题文档</title> 6 </head> 7 8 <body> 9 <table width="200" border="1"> 10 <tbody> 11 <tr> 12 <th>id </th> 13 <th>name </th> 14 </tr> 15 {volist name="data" id="value"} 16 <tr> 17 <td>{$value.user_id}</td> 18 <td>{$value.user_name}</td> 19 {/volist} 20 </tbody> 21 </table> 22 <h1>测试一下!</h1> 23 </body> 24 </html>
标签:测试 set info sel his table app val end
原文地址:https://www.cnblogs.com/efyefy/p/8748074.html