试图获取多维数组中非对象的属性

时间:2018-08-30 13:25:36

标签: multidimensional-array foreach

请检查以下是我的阵列 yii \ data \ ActiveDataProvider对象 (     [_models:yii \ data \ BaseDataProvider:private] =>数组         (             [0] => app \ modules \ student \ models \ StuMaster对象                 (                     [report_batch_id] =>                     [report_section_id] =>                     [report_city] =>                     [importFile] =>                     [report_subject] =>                     [fee_paid] =>                     [aecc_subject] =>                     [fixed_subject] =>                     [choice_subject] =>                     [ge_subject] =>                     [core3_subject] =>                     [_attributes:yii \ db \ BaseActiveRecord:private] =>数组                         (                             [stu_master_id] => 3652                             [stu_master_stu_info_id] => 5718                             [stu_master_user_id] => 4724                             [stu_master_nationality_id] => 1                             [stu_master_category_id] => 7                             [stu_master_course_id] => 10                             [stu_master_batch_id] => 20                             [stu_master_section_id] => 29                             [stu_master_semester_id] => 24                             [stu_master_stu_status_id] => 4                             [stu_master_stu_address_id] => 4522                             [stu_college_rollno] =>                             [created_at] => 2018-07-10 20:32:33                             [created_by] => 1                             [updated_at] => 2018-07-10 20:42:27                             [updated_by] => 1                             [is_status] => 0                             [stu_on_hold_details] => 1                         )

                [_oldAttributes:yii\db\BaseActiveRecord:private] => Array
                    (
                        [stu_master_id] => 3652
                        [stu_master_stu_info_id] => 5718
                        [stu_master_user_id] => 4724
                        [stu_master_nationality_id] => 1
                        [stu_master_category_id] => 7
                        [stu_master_course_id] => 10
                        [stu_master_batch_id] => 20
                        [stu_master_section_id] => 29
                        [stu_master_semester_id] => 24
                        [stu_master_stu_status_id] => 4
                        [stu_master_stu_address_id] => 4522
                        [stu_college_rollno] => 
                        [created_at] => 2018-07-10 20:32:33
                        [created_by] => 1
                        [updated_at] => 2018-07-10 20:42:27
                        [updated_by] => 1
                        [is_status] => 0
                        [stu_on_hold_details] => 1
                    )

                [_related:yii\db\BaseActiveRecord:private] => Array
                    (
                        [stuMasterStuInfo] => app\modules\student\models\StuInfo Object
                            (
                                [stu_master_category_id] => 
                                [_attributes:yii\db\BaseActiveRecord:private] => Array
                                    (
                                        [stu_info_id] => 5718
                                        [stu_unique_id] => 4522
                                        [stu_title] => Mr.

我想获取stuMasterStuInfo数据 我正在用这个 foreach($ model as $ val){     foreach($ val-> models as $ value){

如果我申请“退出”;在内部循环的末尾,它可以正常工作,但是如果我删除“ exit;”,它返回我试图获取非对象的属性

感谢AK

0 个答案:

没有答案