class Admin extends Model
{
public function profile(){
return $this->hasOne("Profile")->bind{[
'profile_id' =>'id',
]};
}
}
这是MODEL内容
为什么用$data = $model->select();
返回内容
Array
(
[0] => app\common\model\admin\Admin ob
(
[connection:protected] => Array
(
)
[query:protected] =>
[name:protected] => Admin
[table:protected] =>
[class:protected] => app\common\model\admin\Admin
[error:protected] =>
[validate:protected] =>
[pk:protected] =>
[field:protected] => Array
(
)
[readonly:protected] => Array
(
)
[visible:protected] => Array
(
)
[hidden:protected] => Array
(
)
[append:protected] => Array
(
)
[data:protected] => Array
(
[id] => 4
[username] => aa
[nickname] => aa
[password] => 879bc2f5ac19ab567fd68e0bb1f7aa75
[salt] => JBG6qb
[language] => pt-br
[department_id] => 0
[position_id] => 0
[score] => 0
[loginfailure] => 0
[loginip] =>
[logintime] => 1540364919
[createtime] => 1540364919
[updatetime] => 1540364919
[deletetime] => 0
[token] =>
[status] => normal
)
[change:protected] => Array
(
...............
在SELECT()->toArray()出错,和教程说的不一样啊。
最佳答案