Maison > Questions et réponses > le corps du texte
string(145) "{q:"game",p:false,s:["gamersky","game center","gameloft","gameres"
"games for windows live","gamelook","games","gamewith","gameboy","gamemaker"]}"
PHP中文网2017-04-11 09:20:11
这是var_dump输出的,实际字符串为
$s = '{q:"game",p:false,s:["gamersky","game center","gameloft","gameres","games for windows live","gamelook","games","gamewith","gameboy","gamemaker"]}';
$str = preg_replace('/(\w+):/is', '"$1":', $s);
json_decode($str,true);
[
"q" => "game",
"p" => false,
"s" => [
"gamersky",
"game center",
"gameloft",
"gameres",
"games for windows live",
"gamelook",
"games",
"gamewith",
"gameboy",
"gamemaker"
]
]