json_encode,json_decode函数

1.json_encode()函数是把数组转换成json数据格式,需注意json_encode()只支持UTF-8不支持GBK,如果用的数据库是GBK,则需要用iconv("GBK","UTF-8",$x)函数转一下编码才能json_encode();

2.json_decode()函数可以把json转成array(),需注意json_decode($x,true)要把true参数带上;

posted @ 2015-12-16 19:59  ElevenYu  阅读(151)  评论(0编辑  收藏  举报