php 如何解析这样的字符串?
PHP中文网
PHP中文网 2017-04-11 09:18:11
0
3
311

string(145) "{q:"game",p:false,s:["gamersky","game center","gameloft","gameres"
"games for windows live","gamelook","games","gamewith","gameboy","gamemaker"]}"

PHP中文网
PHP中文网

认证0级讲师

répondre à tous (3)
洪涛

这是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" ] ]
    大家讲道理

    json_decode()....不知道对不对

      Ty80

      这个是json数据格式 楼上两位说的都对。

        Derniers téléchargements
        Plus>
        effets Web
        Code source du site Web
        Matériel du site Web
        Modèle frontal
        À propos de nous Clause de non-responsabilité Sitemap
        Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!