我有以下的JSON字符串使用json_decode:如何在PHP
{"createLead":{"client_id":42891}}
需要解析這個字符串PHP用於獲取client_id
值。 使用以下命令:
$json_result= json_decode('{"createLead":{"client_id":42891}}', true);
我怎麼使用越來越client_id
值響應數組? 下面的命令不起作用,並返回空字符串:
$client_id = $json_result['createLead']['client_id'];
什麼是[文件](http://php.net/manual/en/function.json -decode.php)說?你的問題的答案已經在那裏了! – Dragos
它也將幫助你檢查'var_dump($ json_result)' – Dragos
該代碼應該工作。在這之後你用'$ client_id'做了什麼? – Chris