stdClass的對象...找鑑於這種stdClass的結構值
[RecentAchievements] => stdClass Object
(
[1446] => stdClass Object
(
[3319] => stdClass Object
(
[ID] => 3319
[GameID] => 1446
[Title] => Hello World!
[Description] => Complete World 1-1
[Points] => 15
[BadgeName] => 03909
[IsAwarded] => 1
[DateAwarded] => 2013-10-20 19:35:46
)
我需要檢查裏面的3319的對象,如 「標題」,所以它會像:
$data->RecentAchievements->$gameid->ACHVIDHERE->Title;
要獲得$遊戲ID,它來自其他對象(RecentlyPlayed),這樣一來:
[RecentlyPlayed] => Array
(
[0] => stdClass Object
(
[GameID] => 1446
[ConsoleID] => 7
[ConsoleName] => NES
[Title] => Super Mario Bros
[LastPlayed] => 2013-10-20 21:38:22
[ImageIcon] => /Images/000385.png
[ImageTitle] => /Images/000272.png
[ImageIngame] => /Images/000387.png
[ImageBoxArt] => /Images/000275.png
)
)
$gameid = $data3->RecentlyPlayed['0']->GameID;
API不要讓我用同樣的RecentlyPlayed得到achievem ent ID,我必須從RecentAchievements中提取它。可能嗎?
對於我來說,當你需要訪問該元素時,你可以獲得該ID似乎不太可能。你現在的電話沒有獲得更多的信息來獲得'$ gameid'嗎?例如請求它返回一個包含兩個值的數組? –
你的意思是將對象轉換爲數組並提取ID?也許是的,但我正在尋找更乾淨的東西(如果可能的話)。 –