1、新建一个控制器类,D:\wamp\www\wish\APP\Admin\Controller\MsgManageController.class.php
12345678910111213 | 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
123456789101112131415161718192021222324252627 | <!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
123456 | < 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/