我一直在寻找interwebz的简单答案,但找不到任何答案.所以,问题是:
我要解码一些JSON以查看是否存在值; 不过,我认为我做得不对.我想检查appid:730的值是否存在.
这是JSON:
{
response: {
game_count: 106,
games: [
{
appid: 10,
playtime_forever: 67
},
{
appid: 730,
playtime_forever: 0
},
{
appid: 368900,
playtime_forever: 0
},
{
appid: 370190,
playtime_forever: 0
},
]
}
}
Run Code Online (Sandbox Code Playgroud)
这就是我要的:
$json = file_get_contents('JSON URL HERE');
$msgArray = json_decode($json, true);
if (appid: 730 exists) {
...
}
Run Code Online (Sandbox Code Playgroud)
谢谢,希望我解释得足够多.
我是C#的新手,拥有其他语言的基础知识.我想出了这个问题:
public void startupMessage(string appTitle, string (((color))))
{ V--------V
Console.ForegroundColor = ConsoleColor.(((color)));
}
Run Code Online (Sandbox Code Playgroud)
我认为有些问题是第二个参数必须是字符串以外的东西.但我不确定.