我有以下数组:
Array (
[0] => stdClass Object (
[@attributes] => stdClass Object (
[Id] => 0 [MapId] => 1 [Name] => [LocationId] => 0 [MapRelativeX] => 0.58813826735513464 [MapRelativeY] => 0.5223214285714286
)
)
[1] => stdClass Object ( [@attributes] => stdClass Object ( [Id] => 1 [MapId] => 1 [Name] => GL D [LocationId] => 1 [MapRelativeX] => 0.54053714859437729 [MapRelativeY] => 0.43601190476190477 ) ) [2] => stdClass Object ( [@attributes] => stdClass Object ( [Id] => 2 [MapId] => 1 [Name] => GL E [LocationId] => 1 [MapRelativeX] => 0.458028542742398 [MapRelativeY] => 0.5223214285714286 ) )
我正在尝试访问并搜索此数组。例如,我试图访问ID键/值对,但我不能。我有以下代码。
$ row->我不会返回$ row为$ fullArray [0]
的任何内容还有一种方法可以在此数组中搜索ID = 2的行吗?
由于
答案 0 :(得分:0)
想通了:
$row[0]->attributes()->Id
:)