我只需要从包含php stdClass Objects的数组中提取[name]信息。我该怎么办?
Array ( [VigdiH] => stdClass Object ( [ip] => 555.50.175.142 [name] => Test Name [origin] => www [cycle_day] => 3 [email] => adsf0140@ladf.ca [campaign] => 5555 [created_on] => 2014-03-28 14:22:58 [changed_on] => ))
答案 0 :(得分:3)
如果你的数组名为$arr
,你可以这样做:
foreach($arr as $object) {
echo $object->name . "\n";
}
答案 1 :(得分:2)
您可以使用->
$data = array(/**/);
$data["VigdiH"]->name; // name