Home > Backend Development > PHP Tutorial > 求教一个关于对象数组的有关问题

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

WBOY
Release: 2016-06-13 10:15:51
Original
801 people have browsed it

求教一个关于对象数组的问题
本人刚学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 ) )  
Copy after login

这里面的 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'];
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template