Blogger Information
Blog 29
fans 0
comment 0
visits 19619
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
tp新闻实战笔记六(模型应用起步)
牡丹飞
Original
540 people have browsed it

用户模型应用

  1. 建用户表Model 终端运行: php think make:model admin@Users
  2. 指定表主键:app\admin\model\users.php里
    1. class Users extends Model
    2. {
    3. //
    4. protected $pk = 'uid';
    5. }
  3. 修改Controller:app\admin\controller\login.php 中index方法

    • 加Model引用: use app\admin\model\Users as UsersModel;
    • 修改index方法的Db语句为:
      1. $res = UsersModel::field('uid,uname,pwd')->where('uname',$uname)->find();
  4. 其他的大家按tp6手册写就好

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post