tp5模型关联,method not exist:think\db\Query->details

浏览:1368 发布日期:2019/07/12 分类:求助交流
模型
public function details()
{
return $this->belongsTo('Detail','id');
}

调用
function mytest(){
$user=model('user')->with('details')->where(['id'=>1])->select();
// $users=User::where('id',2)->with('details')->find();
return json(['code'=>200,'data'=>$user]);
}

然后报错
method not exist:think\db\Query->details
最佳答案
评论( 相关
后面还有条评论,点击查看>>