int(1) ["b"] => int(2) ["c"] => int(3) ["d"] => int(4) _json_decode">
当前位置:   article > 正文

json_decode用法

json_decode
$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
//解析为json对象
var_dump(json_decode($json));
//解析为数组
var_dump(json_decode($json, true));
代码执行结果
object(stdClass)#1 (5) {
    ["a"] => int(1)
    ["b"] => int(2)
    ["c"] => int(3)
    ["d"] => int(4)
    ["e"] => int(5)
}

array(5) {
    ["a"] => int(1)
    ["b"] => int(2)
    ["c"] => int(3)
    ["d"] => int(4)
    ["e"] => int(5)
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/146921
推荐阅读
相关标签
  

闽ICP备14008679号