Heim >Backend-Entwicklung >PHP-Tutorial > 求教一个关于对象数组的有关问题

求教一个关于对象数组的有关问题

WBOY
WBOYOriginal
2016-06-13 13:38:19777Durchsuche

求教一个关于对象数组的问题
本人刚学php,有个小问题不知道怎么解决。

我有一个数组,数组里的内容如下:

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
Array ( 
[0] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => 1 ) 
[1] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => 1333353649:1 )
[2] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => flash )
[3] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => field_4ecbd5f8c4dbe )
[4] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => http://www.baidu.com ) 
[5] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => field_4ecbd6154b2a7 ) 
[6] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => 这是一个地址文件 ) 
[7] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => field_4ecbd9d8b1b04 ) 
[8] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => 010-100000 ) 
[9] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => field_4ecbd9ed176ed ) 
[10] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => http://www.Google.com ) 
[11] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => field_4ecbda0cc2f65 ) 
[12] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => 什么都没有 ) 
[13] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => field_4ecbda2cce3cf ) 
[14] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => 汉语 ) 
[15] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => field_4ecbdad643aa0 ) 
[16] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => FM ) 
[17] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => field_4ecbdbc2bbc73 ) 
[18] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => 999.8 ) 
[19] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => field_4ecbdbd8600a5 ) 
[20] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => 200000000 ) 
[21] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => field_4ecbdc0b38fe2 ) 
[22] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => 90 ) 
[23] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => ) 
[24] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => field_4ecc8cb6be29c ) 
[25] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => ) 
[26] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => field_4ecc97529e9f4 ) 
[27] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => 176
 ) )  



这里面的 title基本都是一样的。我如何取出meta_value里的每一项值呢?

求高人指点


------解决方案--------------------
如果是:
$arr = 
Array ( 
[0] => stdClass Object ( [post_title] => 测试标题基本一样啊 [meta_value] => array(123,'abc',['param']=>'param_value') ) 
)

$abc = $arr->meta_value[1];
$param = $arr->meta_value['param'];
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel: 自学PHP,该怎么处理 Nächster Artikel: php初学,将asp代码转为php