前台代码:
后台代码:
$searchtype = $_POST['searchtype'];
$searchterm = trim($_POST['searchterm']);
如题,当form表单以post方式提交时,后台获取不到传递的数据。但如果把post换成get,后台就可以正常获取数据。不知什么原因?
F12审查元素,点submit后的的信息如下:
Request URL:http://localhost:63342/PHP/results.php
Request Method:POST
Status Code:200 OK
Remote Address:127.0.0.1:63342
Response Headers
view source
access-control-allow-credentials:true
access-control-allow-headers:accept
access-control-allow-headers:content-type
access-control-allow-headers:origin
access-control-allow-headers:authorization
access-control-allow-origin:http://localhost:63342
content-length:2106
Content-type:text/html; charset=UTF-8
server:PhpStorm 2016.2.1
vary:origin
X-Powered-By:PHP/7.0.12
Request Headers
view source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, br
Accept-Language:zh-CN,zh;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:44
Content-Type:application/x-www-form-urlencoded
Cookie:Phpstorm-e596b797=07c19a4d-d2ed-4587-97d7-d472f4a91180
Host:localhost:63342
Origin:http://localhost:63342
Referer:http://localhost:63342/PHP/04220957test.php?_ijt=a553en28un9o83crao16obik2u
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36
Form Data
view source
view URL encoded
searchtype:author
searchterm:T
submit:Search
看样子是正常post数据成功了,但为啥后台获取不到呢