js里escape是unicode编码,php不好解。
js和php的urlencode urldecode好像也不一样不知js如何传中文参数给php?
谢谢
js和php的urlencode urldecode好像也不一样不知js如何传中文参数给php?
谢谢
解决方案 »
- 面向对象中的反射API实现问题:只是一个小问题,不过纠结了我好久
- php1 post php2,php2中$_POST没数据$_GET有数据
- setcookie与_COOKIE[]的执行顺序
- php如何得到access数据库返回的行数。急!急
- php 创建网站快捷方式 代图标
- 怎么可以在服务器连接满员的时候提示“请稍后访问,访问过多”
- PHP+MYSQL系统致命伤=“数据库连接上限”?
- 请教个问题
- 请教PHP.ini session.cache_limiter设置问题?
- 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的。