PHP JSON(解码)

时间:2017-04-30 16:03:25

标签: php arrays json

如何通过PHP从这个JSON中获取“required_version”?

{
    "response": {
        "success": true,
        "up_to_date": false,
        "version_is_listable": false,
        "required_version": 13576,
        "message": "Your server is out of date, please upgrade"
    }
}

非常感谢, 最诚挚的问候 恩格

1 个答案:

答案 0 :(得分:0)

$json = <<<'__EOS__'
{
    "response": {
        "success": true,
        "up_to_date": false,
        "version_is_listable": false,
        "required_version": 13576,
        "message": "Your server is out of date, please upgrade"
    }
}
__EOS__;

$obj = json_decode($json);
echo $obj->response->required_version;