MODEL SELECT()返回为什么是数组不是对象

浏览:658 发布日期:2018/11/03 分类:求助交流
use think\Model;

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 object
(
[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()出错,和教程说的不一样啊。
最佳答案
评论( 相关
后面还有条评论,点击查看>>