>백엔드 개발 >PHP 튜토리얼 > 求教一个关于对象数组的有关问题

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

WBOY
WBOY원래의
2016-06-13 13:38:19771검색

求教一个关于对象数组的问题
本人刚学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'];
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.