将PHP结果数组转换为JSON [英] Converting PHP result array to JSON
本文介绍了将PHP结果数组转换为JSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在PHP中将结果数组转换为JSON格式.这是我的代码:
I want to convert my result array to JSON format in PHP. Here is my code:
$row = mysql_fetch_array($result)
我想将$row
转换为JSON格式,并将JSON数据传递给jQuery插件.
I want to convert $row
to JSON format and pass the JSON data to an jQuery plugin.
推荐答案
json_encode
在php> 5.2.0中可用:
json_encode
is available in php > 5.2.0:
echo
json_encode
($row);
这篇关于将PHP结果数组转换为JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文