最近遇到一个问题,在用TP做系统的时候,我建立的表是 “tp_admin_user” 但是要用到的模型是 “AdminUserModel.model.class.php”,应该如何做?

解决方法:

<?php
namespace Admin\Model;
use Think\Model;
class AdminUserModel extends Model{    
    protected $tableName = 'admin_user';//不包含表前缀
    protected $trueTableName  = 'tp_admin_user';//包含表前缀
}

详看:

http://document.thinkphp.cn/manual_3_2.html#define_model

 

相关文章:

  • 2022-02-15
  • 2021-05-03
  • 2021-12-04
  • 2021-04-03
  • 2021-11-18
  • 2022-12-23
  • 2021-10-15
猜你喜欢
  • 2022-12-23
  • 2021-10-10
  • 2021-09-26
  • 2021-10-11
  • 2021-05-20
  • 2021-12-04
相关资源
相似解决方案