json不支援中文寫入的問題解決

2021-06-18 22:42:47 字數 2771 閱讀 5768

寫兩個函式,使其支援中文:

function json($array)

呼叫示例如下:

$guanggao_list=array(

0=>array(

"iid"=>21341872612,

"goods_name"=>"**熱銷**男士韓版修身褲休閒褲男褲 修身版休閒**長褲子",

"goods_list_img"=>"",

"url"=>"",

"shichangjia"=>"359.00",

"taobaojia"=>"199.00",

"daoqi"=>1362105283,

"wangwang"=>"芭菲雨"

),1=>array(

"iid"=>21341872612,

"goods_name"=>"**熱銷**男士韓版修身褲休閒褲男褲 修身版休閒**長褲子",

"goods_list_img"=>"",

"url"=>"",

"shichangjia"=>"359.00",

"taobaojia"=>"199.00",

"daoqi"=>1372105283,

"wangwang"=>"小魚兒"

),2=>array(

"iid"=>21341872612,

"goods_name"=>"**熱銷**男士韓版修身褲休閒褲男褲 修身版休閒**長褲子",

"goods_list_img"=>"",

"url"=>"",

"shichangjia"=>"359.00",

"taobaojia"=>"199.00",

"daoqi"=>1362105283,

"wangwang"=>"芭菲雨"

),3=>array(

"iid"=>21341872612,

"goods_name"=>"**熱銷**男士韓版修身褲休閒褲男褲 修身版休閒**長褲子",

"goods_list_img"=>"",

"url"=>"",

"shichangjia"=>"359.00",

"taobaojia"=>"199.00",

"daoqi"=>1362105283,

"wangwang"=>"芭菲雨"

),4=>array(

"iid"=>21341872612,

"goods_name"=>"**熱銷**男士韓版修身褲休閒褲男褲 修身版休閒**長褲子",

"goods_list_img"=>"",

"url"=>"",

"shichangjia"=>"359.00",

"taobaojia"=>"199.00",

"daoqi"=>1362105283,

"wangwang"=>"芭菲雨"

),5=>array(

"iid"=>21341872612,

"goods_name"=>"**熱銷**男士韓版修身褲休閒褲男褲 修身版休閒**長褲子",

"goods_list_img"=>"",

"url"=>"",

"shichangjia"=>"359.00",

"taobaojia"=>"199.00",

"daoqi"=>1362105283,

"wangwang"=>"芭菲雨"

),6=>array(

"iid"=>21341872612,

"goods_name"=>"**熱銷**男士韓版修身褲休閒褲男褲 修身版休閒**長褲子",

"goods_list_img"=>"",

"url"=>"",

"shichangjia"=>"359.00",

"taobaojia"=>"199.00",

"daoqi"=>1362105283,

"wangwang"=>"芭菲雨"

),7=>array(

"iid"=>21341872612,

"goods_name"=>"**熱銷**男士韓版修身褲休閒褲男褲 修身版休閒**長褲子",

"goods_list_img"=>"",

"url"=>"",

"shichangjia"=>"359.00",

"taobaojia"=>"199.00",

"daoqi"=>1362105283,

"wangwang"=>"芭菲雨"

),8=>array(

"iid"=>21341872612,

"goods_name"=>"**熱銷**男士韓版修身褲休閒褲男褲 修身版休閒**長褲子",

"goods_list_img"=>"",

"url"=>"",

"shichangjia"=>"359.00",

"taobaojia"=>"199.00",

"daoqi"=>1362105283,

"wangwang"=>"芭菲雨"

),9=>array(

"iid"=>21341872612,

"goods_name"=>"**熱銷**男士韓版修身褲休閒褲男褲 修身版休閒**長褲子",

"goods_list_img"=>"",

"url"=>"",

"shichangjia"=>"359.00",

"taobaojia"=>"199.00",

"daoqi"=>1362105283,

"wangwang"=>"芭菲雨"

));$str=json($guanggao_list);

print_r($str);

linux vi 不支援中文

問題說明 網頁html與chi語言的結合,使用c語言輸出html語句,因為其中用到中文,出現亂碼 問題解決 1.在cgi中用到的 使用utf 8編碼,utf 8是國際統一的中文編碼 具體語句為 fprintf cgiout,metacharset utf 8 參考文章 2.上述步驟完成後,重新編譯,...

ubuntu server 不支援中文顯示

今天發現ubuntu server有乙個問題,就是不支援中文顯示。執行touch 哈哈,檔案建立成功,但使用ls檢視檔名的話,顯示的是一堆問號。有意思的是,想刪除它的話,必須使用rm 哈哈才可以,使用rm 的話是不行的。檔案中的中文也顯示為幾個問號。我從網上查了一下,執行了一下下面的命令 dpkg ...

Calcium不支援中文VS

如果有人用過calcium這個wpf的框架,我猜測都是在英文環境下使用的。總之這個東西整整花了我一天的時間去搞,sdk的安裝非常的簡單,簡單到傻瓜化的地步,而我用的清華的正版vs2010和2008都看不到新建calcium專案的選項,嘗試了很久一直被抑鬱,堅定地不重灌系統一遍又一遍的嘗試,最後發現同...