PHP 怎么将字符串转换成json格式输出

php函数:json_encode 和 json_decode

json_decode($str, true) 可以得到数组,第二参数不加默认为false,得到对象