<?php
$b = '{
"encoding" : "UTF-8",
"plug-ins" : [
"python",
"c++",
"ruby"
],
"indent" : { "length" : 3, "use_space" = true }
}';
print "\n\n\n=================================\n";
$barr = json_decode($b, true);
print_r($barr);
?>
这不会在控制台上打印任何内容。上面的JSON格式有问题吗? - 或者我错过了一个技巧?
答案 0 :(得分:4)
答案 1 :(得分:3)
indent
属性的use_space
属性中包含错误:
"indent" : { "length" : 3, "use_space" = true }
等于该应该是冒号。
"indent" : { "length" : 3, "use_space" : true }
答案 2 :(得分:1)
$b = '{
"encoding" : "UTF-8",
"plug-ins" : [
"python",
"c++",
"ruby"
],
"indent" : { "length" : 3, "use_space" : true }
}';
print "\n\n\n=================================\n";
$barr = json_decode($b, true);
print_r($barr);
&GT;