請問一下該如何解析出這個數組呢?謝謝了。
Array
(
[doctorDate] => Array
(
[0] => Array
(
[doctorOfDate] => 2013-10-02
[orderingCount] => 12
)
[1] => Array
(
[doctorOfDate] => 2013-10-03
[orderingCount] => 8
)
)
)
分享到:
------解決方案--------------------
假設數組名為:test
test['doctorDate'][0]['doctorOfDate']=2013-10-02
test['doctorDate'][0]['orderingCount']=12
test['doctorDate'][1]['doctorOfDate']=2013-10-03
test['doctorDate'][1]['orderingCount']=8
這個數組的定義是:
test=array('doctorDate'=>
array(0=>array('doctorDate'=>'2013-10-02',
'orderingCount'=>12),
1=>array('doctorDate'=>'2013-10-03',
'orderingCount'=>8)
)
)
------解決方案--------------------
$test=array('doctorDate'=>
array(0=>array('doctorDate'=>'2013-10-02',
'orderingCount'=>12),
1=>array('doctorDate'=>'2013-10-03',
'orderingCount'=>8)
)
);
foreach ($test as $arr)
{
foreach ($arr as $value)
{
echo $value['doctorDate'].' '.$value['orderingCount'].'
';
}
}
?>