这应该可以解决问题!
// convert object => json$json = json_enpre($myObject);// convert json => object$obj = json_depre($json);
这是一个例子
$foo = new StdClass();$foo->hello = "world";$foo->bar = "baz";$json = json_enpre($foo);echo $json;//=> {"hello":"world","bar":"baz"}print_r(json_depre($json));// stdClass Object// (// [hello] => world// [bar] => baz// )如果您希望输出为数组而不是对象,则传递
true给
json_depre
print_r(json_depre($json, true));// Array// (// [hello] => world// [bar] => baz// )



