class Index {
public function index() {
$user = User::find(1);
// 输出Profile关联模型的email属性
echo $user->profile->email;
}
class User extends Model{
public function profile(){
return $this->hasMany(profile::class);
}
}
我一摸一样建的表和模型为什么总是提示
Undefined property: think\model\Collection::$email