天天看点

***php解析JSON二维数组字符串(json_decode函数第二个参数True和False的区别)json_decode

-------------------------------------------------------------------------------------------------------

json_decode函数第二个参数True和False的区别

默认值:false,返回object对象

Array

(

[0] => stdClass Object

[name] => C51790CC-EDEF-4DF7-9CC7-FE8F4DC8138B&ext=JPG

[width] => 200

[height] => 149

)

[1] => stdClass Object

[name] => 4E6A33AD-D9AE-47CD-9711-E95D9184FBC2&ext=JPG.jpg

[width] => 160

[height] => 160

为true的情况,返回数组array:

[0] => Array

[1] => Array

官方解释:

(PHP 5 >= 5.2.0, PECL json >= 1.2.0)

json_decode — 对 JSON 格式的字符串进行编码

接受一个 JSON 格式的字符串并且把它转换为 PHP 变量

<dl></dl>

<dt><code>json</code></dt>

<dd></dd>

This function only works with UTF-8 encoded data.

<dt><code>assoc</code></dt>

<dt><code>depth</code></dt>

User specified recursion depth.

<dt><code>options</code></dt>

Bitmask of JSON decode options. Currently only <code>JSON_BIGINT_AS_STRING</code> is supported (default is to cast large integers as floats)

Returns the value encoded in <code>json</code> in appropriate PHP type. Values true, false and null (case-insensitive) are returned as <code>TRUE</code>, <code>FALSE</code> and<code>NULL</code> respectively. <code>NULL</code> is returned if the <code>json</code> cannot be decoded or if the encoded data is deeper than the recursion limit.

如何联系我:【万里虎】www.bravetiger.cn

【QQ】3396726884 (咨询问题100元起,帮助解决问题500元起)

【博客】http://www.cnblogs.com/kenshinobiy/