一直在與這個看起來像永遠一樣的對手。另一個php數組循環問題
我有一個數組:
$url_array
它包含以下信息:
Array (
[ppp] => Array (
[0] => stdClass Object (
[id] => 46660
[entity_id] => 0
[redirect_url] => http://www.google.com
[type] => Image
)
[1] => stdClass Object (
[id] => 52662
[entity_id] => 0
[pixel_redirect_url] => http://www.yahoo.com
[type] => Image
)
[2] => stdClass Object (
[id] => 53877
[entity_id] => 0
[redirect_url] => http://www.msn.com
[pixel_type] => Image
)
)
[total_count] => 3
)
我通過它需要循環,做事情每個變量。我能得到這個工作:
foreach ($piggies_array as $key => $value) {
$id = $value[0]->id;
$redirect_url = $value[0]->redirect_url; }
不令人吃驚,這只是附和這些變量的第一個值,但無論我怎麼努力我不能打通循環:
$value->redirect_url;
$value=>redirect_url;
我會感謝任何幫助。
你通過'$ url_array'或通過'$ url_array循環[「PPP」]'? –