stdClass Object
(
[form] => stdClass Object
(
[fieldsets] => Array
(
[0] => stdClass Object
(
[fieldset_name] => name_1
[datapoints] => Array
(
[0] => stdClass Object
(
[dp_id] => 4
)
[1] => stdClass Object
(
[dp_id] => 5
)
)
)
[1] => stdClass Object
(
[fieldset_name] => name_2
[datapoints] => Array
(
[0] => stdClass Object
(
[dp_id] => 1
)
[1] => stdClass Object
(
[dp_id] => 3
)
)
)
)
)
)
现在我想将dp id的值分别分别放入。,array(4,5)和array(1,3)中的两个数组
答案 0 :(得分:2)
foreach($object->form->fieldsets as $fieldset) {
$dp_ids = array();
foreach($fieldset->datapoints as $datapoint)
$dp_ids[] = $datapoint->dp_id;
var_dump($dp_ids);
}
答案 1 :(得分:0)
试试这个。
$object->form['fieldsets'][1]->datapoints[1]