2011-07-25 20 views
0

私はImagesという名前の配列を持ち、そこから値を取得したいと思います。PHPの配列から値を取得

array(1) { 
[924]=> 
object(stdClass)#4240 (24) { 
["ID"]=> 
int(924) 
["post_author"]=> 
string(1) "1" 
["post_date"]=> 
string(19) "2011-07-25 15:20:50" 
["post_date_gmt"]=> 
string(19) "2011-07-25 15:20:50" 
["post_content"]=> 
string(0) "" 
["post_title"]=> 
string(17) "Rezept zum Glück" 
["post_excerpt"]=> 
string(0) "" 
["post_status"]=> 
string(7) "inherit" 
["comment_status"]=> 
string(6) "closed" 
["ping_status"]=> 
string(4) "open" 
["post_password"]=> 
string(0) "" 
["post_name"]=> 
string(19) "rezept-zum-glueck-2" 
["to_ping"]=> 
string(0) "" 
["pinged"]=> 
string(0) "" 
["post_modified"]=> 
string(19) "2011-07-25 15:20:50" 
["post_modified_gmt"]=> 
string(19) "2011-07-25 15:20:50" 
["post_content_filtered"]=> 
string(0) "" 
["post_parent"]=> 
int(922) 
["guid"]=> 
string(60) "/wp-content/uploads/useruploads/rezept-zum-glueck-bild-1.jpg" 
["menu_order"]=> 
int(0) 
["post_type"]=> 
string(10) "attachment" 
["post_mime_type"]=> 
string(10) "image/jpeg" 
["comment_count"]=> 
string(1) "0" 
["filter"]=> 
string(3) "raw" 

}}

をどのように私はそれから "GUID" の値を取得します:これは私の配列が含まれているデータは、ありますか?

答えて

1
$guid = $your_array[924]->guid 

あなたはどのようにこの作品についての詳細を学ぶためにarraysobjects上のドキュメントを読んでください。また、what is stdClass

0

オブジェクトにはその配列の唯一の要素があります。

事前に924を知っているかどうかによって、$images[924]->guidをやりたいと思います。それ以外の場合は、foreachで何かをする必要があります。

0

これはハッシュです。方法について

$obj = (obj) $my_array["924"]; 
$guid = obj["guid"]; 

私はちょうどここで推測しているが、動作する可能性があります。

関連する問題