(javascript)を介してサーバーにPOSTリクエストを送信しようとするとxmlhttp.open("POST", "url", true)
、空になります$_POST array
。
Firebugは、データが送信されていることを示しています。Firebugからのデータ文字列は次のとおりa=1&q=151a45a150...
です。しかし、$_POST['q']
何も返しません。
興味深いのはfile_get_contents('php://input')
、私のデータ(上記の文字列)が含まれていることですが、PHPはどういうわけかそれを認識しません。$_POSTと$_REQUESTの両方を試しましたが、何も機能しません。
送信されるヘッダー:
POST /test.php HTTP/1.1
Host: website.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://website.com/
Content-Length: 156
Content-Type: text/plain; charset=UTF-8
Pragma: no-cache
Cache-Control: no-cache
提案ありがとうございます。