TP5 Establishing a corporate website and calling the administrator list
清雨
清雨 2017-09-26 21:57:29
0
1
968

1.png

File structure

Controller code

<?php

namespace app\admin\controller;

use app\admin\common\Base;
use think\Request;
use app\admin\model\Admin as AdminModel;
class Admin extends Base{
    //显示管理员首页
    public function index()
    {
        //1.读取admin管理员表的信息
        $admin = AdminModel::get(['username'=> 'admin']);
        //2.将当前管理员的信息赋值给模板
        $this -> view -> assign('admin', $admin);
        //3.渲染模板
        return $this -> view -> fetch('admin_list');
    }
}

Error message

2.png

清雨
清雨

reply all(1)
清雨

The problem has been solved. It appears in the database table. When the front-end calls the database list, the lowercase id is used. In the database, the id is Id, so there is a problem.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template