是object类型,不是std Object这种
如下:
object(test\myyii\models\Customer)#67 (8) { ["_attributes":"yii\db\BaseActiveRecord":private]=> array(7) { ["id"]=> int(7) ["username"]=> string(6) "老王" ["admin_id"]=> string(1) "0" ["company_id"]=> string(1) "2" ["id_card"]=> string(18) "510321199201012234" ["telphone"]=> string(11) "15877556633" ["created_at"]=> int(1467104334) } ["_oldAttributes":"yii\db\BaseActiveRecord":private]=> array(7) { ["id"]=> int(7) ["username"]=> string(6) "老王" ["admin_id"]=> string(1) "0" ["company_id"]=> string(1) "2" ["id_card"]=> string(18) "510321199201012234" ["telphone"]=> string(11) "15877556633" ["created_at"]=> int(1467104334) } ["_related":"yii\db\BaseActiveRecord":private]=> array(0) { } ["_errors":"yii\base\Model":private]=> NULL ["_validators":"yii\base\Model":private]=> NULL ["_scenario":"yii\base\Model":private]=> string(7) "default" ["_events":"yii\base\Component":private]=> array(0) { } ["_behaviors":"yii\base\Component":private]=> array(0) { } }
ActiveRecord:查询的直接加上asArray();
$userAll = User::find()->asArray()->all();
这对象本身就可以当数组用,因为他实现了ArrayAccess接口