1.C:\phpStudy\PHPTutorial\WWW\owz\application\admin\controller
创建Message.php文件
C:\phpStudy\PHPTutorial\WWW\owz\application\admin\controller\Message.php
CTRL+R 全部替换
<?php
namespace app\admin\controller;
use think\Controller;
class Message extends Controller
{
public function lst() // 加载管理员列表
{
$messageres=\think\Db::name('message')->paginate(3);
$this->assign('messageres',$messageres);
// dump($list);
return $this->fetch();
}
}
C:\phpStudy\PHPTutorial\WWW\owz\application\admin\view
创建"Message"文件夹
C:\phpStudy\PHPTutorial\WWW\owz\application\admin\view\Admin
中的lst.html文件复制到\admin\view\Admin文件下
2.C:\phpStudy\PHPTutorial\WWW\owz\application\admin\view\Message\lst.html
{volist name="list" id="vo"} 修改为:{volist name="messageres" id="vo"}
{$list->render()} 修改为:{$messageres->render()}
3.C:\phpStudy\PHPTutorial\WWW\owz\application\admin\view\Message\lst.html
修改为:
<thead class="">
<tr>
<th class="text-center" width="5%">ID</th>
<th class="text-center">管理员名称</th>
<th class="text-center" width="14%">操作</th>
</tr>
</thead>
<tbody>
{volist name="messageres" id="vo"}
<tr>
<td align="center">{$vo.id}</td>
<td title="{$vo.name}"><a target="_blank" href="#" title="{$vo.name}">{$vo.name}</a>
</td>
显示出admin——>message——>lst.html中的name信息!
http://www.iheyu.com/owz/public/index.php/admin/message/lst.html
4.把其它的信息也显示出来:
C:\phpStudy\PHPTutorial\WWW\owz\application\admin\view\Message\lst.html
修改信息:
<tr>
<th class="text-center" width="5%">ID</th>
<th class="text-center">管理员名称</th>
<th class="text-center" width="14%">操作</th>
</tr>
</thead>
<tbody>
{volist name="messageres" id="vo"}
<tr>
<td align="center">{$vo.id}</td>
<td title="{$vo.name}"><a target="_blank" href="#" title="{$vo.name}">{$vo.name}</a></td>
<td title="{$vo.telephone}"><a target="_blank" href="#" title="{$vo.telephone}">{$vo.telephone}</a></td>
<td title="{$vo.address}"><a target="_blank" href="#" title="{$vo.address}">{$vo.address}</a></td>
<td title="{$vo.email}"><a target="_blank" href="#" title="{$vo.email}">{$vo.email}</a></td>
<td title="{$vo.content}"><a target="_blank" href="#" title="{$vo.content}">{$vo.content}</a></td>
http://www.iheyu.com/owz/public/index.php/admin/message/lst.html