时间:2021-07-01 10:21:17 帮助过:4人阅读
01
//http://blog.1dnet.net
02
function
_encode(
$arr
)
03
{
04
$na
=
array
();
05
foreach
(
$arr
as
$k
=>
$value
) {
06
$na
[_urlencode(
$k
)] = _urlencode (
$value
);
07
}
08
return
addcslashes
(urldecode(json_encode(
$na
)),
"\r\n"
);
09
}
10
11
function
_urlencode(
$elem
)
12
{
13
if
(
is_array
(
$elem
)){
14
foreach
(
$elem
as
$k
=>
$v
){
15
$na
[_urlencode(
$k
)] = _urlencode(
$v
);
16
}
17
return
$na
;
18
}
19
return
urlencode(
$elem
);
20
}
http://www.bkjia.com/PHPjc/735166.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/735166.htmlTechArticle解决以下问题 json_encode 中文后的字符串不可阅读 json_encode 多级数组中文乱码问题 json_encode 数组中包含换行时错误问题 json_encode 数组中键为...