PHP json字符串转对象输出

430 阅读1分钟

php返回json,xml,JSONP等格式的数据

返回json数据:

header('Content-Type:application/json; charset=utf-8');

$arr = '{"success":true,"code":200,"msg":"操作成功","obj":null,"map":null}";

$jsons= json_decode($arr, true);

exit(json_encode($jsons));