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
最佳答案
