TP5多对多关联查询报错,能帮我看看哪边的问题吗?

浏览:555 发布日期:2017/07/05 分类:ThinkPHP5专区
1.刚接触TP5,看了手册里的关联模型也是云里雾里,上来求助下~~还望解答。先贴上报错截图


2.模型代码如下namespace app\index\model;
use think\Model;
class User extends Model{
    public function group(){
        //用户表 belongsToMany 用户组表(关联模型,中间表,关联id1,关联id2)
                return $this->belongsToMany('Group','auth_group_access','uid','group_id');
        }
}
3.控制器代码如下namespace app\index\controller;
use think\Controller;
use think\Db;
use think\Request;
use app\index\model\User as Usermodel;

class User extends Controller{
     //用户列表
    public function index(){
        $user = new Usermodel();
        $data = $user->group;
        p($data);die;
        $this->assign('v',$data);
        return $this -> fetch();
    }
最佳答案
评论( 相关
后面还有条评论,点击查看>>