對於PHP而言,解碼$ _POST作爲application/x-www-form-urlencoded通過AJAX發送是否正常?PHP不解碼POST
我想使用urldecode,但它擺脫了我的+字符。幫幫我?
:
15:51:55.490[755ms][total 755ms] Status: 200[OK]
POST Load Flags[LOAD_BYPASS_CACHE LOAD_BACKGROUND ] Content Size[72] Mime Type[text/html]
Request Headers:
Host[]
User-Agent[Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8]
Accept[text/html, */*]
Accept-Language[en-us,en;q=0.5]
Accept-Encoding[gzip,deflate]
Accept-Charset[ISO-8859-1,utf-8;q=0.7,*;q=0.7]
Keep-Alive[115]
Proxy-Connection[keep-alive]
Content-Type[application/x-www-form-urlencoded; charset=UTF-8]
X-Requested-With[XMLHttpRequest]
Content-Length[164]
Pragma[no-cache]
Cache-Control[no-cache]
Post Data:
id[133]
content[%253Cp%253E%250A%2509Test%2520test%2520-%2520this%2520will%2520disappear%253A%2520%2B%253C%2Fp%253E%250A]
title[Plus%2520character%2520not%2520working]
Response Headers:
Via[1.1 KIGALI]
Connection[Keep-Alive]
Proxy-Connection[Keep-Alive]
Content-Length[72]
Date[Mon, 02 Aug 2010 03:51:55 GMT]
Content-Type[text/html; charset=utf-8]
Server[Apache/2.2.12 (Ubuntu)]
X-Powered-By[PHP/5.2.10-2ubuntu6.4]
Vary[Accept-Encoding]
Keep-Alive[timeout=15, max=100]
這是urldecode所做的(直接從doc: *加號('+')被解碼爲空格字符*)。請張貼一些示例代碼。不,$ _POST對於常規請求或ajax請求將以相同的方式工作。 – Ben 2010-08-01 23:39:31
不,這是不正常的提問,而不帶一些例子讓別人明白你在說什麼 – 2010-08-02 02:45:06
由於在發佈數據中有正確編碼爲'%2B'的'+'符號,請顯示您的PHP代碼。 – 2010-08-02 03:57:46