解决 json_encode 中文乱码
生活随笔
收集整理的這篇文章主要介紹了
解决 json_encode 中文乱码
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
來源: http://www.phpchina.com/archives/view-42572-1.html
解決以下問題
【php代碼】
function _encode($arr) {$na = array();foreach ( $arr as $k => $value ) { $na[_urlencode($k)] = _urlencode ($value); }return addcslashes(urldecode(json_encode($na)),"\r\n"); }function _urlencode($elem) {if(is_array($elem)){foreach($elem as $k=>$v){$na[_urlencode($k)] = _urlencode($v);}return $na;}return urlencode($elem); }?
總結
以上是生活随笔為你收集整理的解决 json_encode 中文乱码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: yii blog页面不能正确显示js,c
- 下一篇: 给VMWare虚拟机做快照--保存你的劳