我有以下数组(用于格式化的print_r):
$result = Array
(
[link] => http://www.mysite.com/article/102758
[type] => Article
[title] => Sweetbay, PepsiCo Round the Bases
[user] => <a href="/user/13208" title="View user profile.">pmalinowska</a>
[date] => 1306512291
[node] => stdClass Object
(
[id] => dbcd60fee884/node/102758
[nid] => 102758
[uid] => 13208
[title] => Sweetbay, PepsiCo Round the Bases
[type] => article
[created] => 1306412903
[changed] => 1306512291
[comment_count] => 0
[name] => pmalinowska
[url] => http://www.mysite.com/article/102758
[path] => node/102758
[score] => 1.2324483
)
)
我如何获取节点元素的created属性的值?我尝试了以下内容:
$result->node->created;
$result['node']['created'];
$result->node['created']
他们都没有工作。
答案 0 :(得分:6)
尝试
$result[ "node" ]->created
$result
是一个数组,而$result[ "node" ]
是一个对象
答案 1 :(得分:2)
试试这个:
$result['node']->created
答案 2 :(得分:2)
答案 3 :(得分:1)
我认为$ result ['node'] - &gt; created;