学习ThinkPHP3.2.2:video15,后台在table中显示许愿

时间:2022-10-29 11:56:28

1、新建一个控制器类,D:\wamp\www\wish\APP\Admin\Controller\MsgManageController.class.php

1
2
3
4
5
6
7
8
9
10
11
12
13
namespace  Admin\Controller;
use  Think\Controller;
 
// 继承CommonController类的功能
class  MsgManageController  extends  CommonController {
 
     Public  function  index(){
         $wish  = M( 'wish' )->select();
         p( $wish );
         die ();
 
         $this ->display();
     }


2、新建一个模板文件,用于在后台显示许愿列表。D:\wamp\www\wish\APP\Admin\View\MsgManage_index.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html  xmlns = "http://www.w3.org/1999/xhtml" >
     < head >
         <!-- <link rel="stylesheet" href="__PUBLIC__/Css/login.css" /> -->
         < meta  http-equiv = "Content-Type"  content = "text/html;charset=utf-8" >
         < script  type = "text/javascript" >
             // var verifyURL = '{:U("Admin/Login/verify",'','')}';
         </ script >
         < css  file  '__PUBLIC__/css/public.css'  />
         < js  file  '__PUBLIC__/Js/jquery-1.7.2.min.js'  />
     </ head >
 
     < body >
         < table  class = "table" >
             < tr >
                 < th >ID</ th >
                 < th >发布人</ th >
                 < th >内容</ th >
                 < th >时间</ th >
                 < th >操作</ th >
             </ tr >
 
         </ table >
 
 
     </ body >
</ html >

现在仅显示标题。


3、修改后台主模板,D:\wamp\www\wish\APP\Admin\View\Index_index.html

1
2
3
4
5
6
< div  id = "left" >
     < dl >
         < dt >帖子管理</ dt >
         < dd >< a  href = "{:U('Admin/MsgManage/index', '', '')}" >查看所有帖子</ a ></ dd >
         < dd >< a  href = "#" >功能标题</ a ></ dd >
         < dd >< a  href = "#" >功能标题</ a ></ dd >


4、浏览:http://localhost/wish/index.php/Admin/MsgManage/

学习ThinkPHP3.2.2:video15,后台在table中显示许愿