【发布时间】:2011-05-19 03:38:57
【问题描述】:
我正在使用 Ajax 发布内容,并且我正在使用 http.send(encodeURIComponent(params)); 进行编码……但我无法在 PHP 中对其进行解码。我正在使用 POST,所以我认为它不需要编码?我很困惑我应该如何解码 PHP 中的值...
params = "guid="+szguid+"&username="+szusername+"&password="+szpassword+"&ip="+ip+"&name="+name+"&os="+os;
//alert(params);
document.body.style.cursor = 'wait';//change cursor to wait
if(!http)
http = CreateObject();
nocache = Math.random();
http.open('post', 'addvm.php');
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = SaveReply;
http.send(encodeURIComponent(params));
【问题讨论】:
标签: php javascript ajax urlencode encodeuricomponent