js里escape是unicode编码,php不好解。
js和php的urlencode urldecode好像也不一样不知js如何传中文参数给php?
谢谢
js和php的urlencode urldecode好像也不一样不知js如何传中文参数给php?
谢谢
解决方案 »
- 问题简单,分不少,帮我在表单提交前加个判断.
- php 如何获取文件上传输入框的真实地址
- 求取出数据库里编号字段的最大值.然后+1 再加上当前时间年+月+日的代码
- 求一则正则表达式和另一个正则表达式或检验方法。(撒分,不够另补!)
- 请教LINUX下文件夹权限问题
- php中如何知道链接成不成功?
- 大家讨论一下,PHP有什么好的类似“如意报表”报表组件吗?
- 高手请看啊,这事真是难做
- 出现"不能连接服务器!"是什么意思,是不是没有数据库?
- 刚写了一点的论坛,请提建议
- <div id="_firebugConsole" style="display: none;" FirebugVersion="1.4.2"/> 究竟是什么
- 能不能用 phpstudy2010 去连接mssql???
把你的代码贴出来看看,是不是其他地方有问题。
<script>
var url="admin/ajaxmodify.php?"+key+"=";
url+=encodeURIComponent(encodeURIComponent(value));
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
</script>
参数是中文encodeURIComponent这个方法必须调用两次
function utf8RawUrlDecode ($source) {
$decodedStr = "";
$pos = 0;
$len = strlen ($source);
while ($pos < $len) {
$charAt = substr ($source, $pos, 1);
if ($charAt == '%') {
$pos++;
$charAt = substr ($source, $pos, 1);
if ($charAt == 'u') {
// we got a unicode character
$pos++;
$unicodeHexVal = substr ($source, $pos, 4);
$unicode = hexdec ($unicodeHexVal);
$entity = "&#". $unicode . ';';
$decodedStr .= utf8_encode ($entity);
$pos += 4;
}
else {
// we have an escaped ascii character
$hexVal = substr ($source, $pos, 2);
$decodedStr .= chr (hexdec ($hexVal));
$pos += 2;
}
} else {
$decodedStr .= $charAt;
$pos++;
}
}
return $decodedStr;
}
这是php的。