lnmp1.4 $_POST 为空
在ubuntu16.10的环境下 安装lnmp1.4 后,当前台使用get方法请求时,$GET有值,当前台使用post方法请求时,$POST无值;获取不到,为什么 基本常见的程序我们都测试过没问题 这是我h5的代码<form action="http://10.0.1.209/blog" method="post">
<textarea style="width: 100%; height: 60px" placeholder="请输入评论内容" name="content"></textarea>
<br>
<input type="text" placeholder="请输入用户名" name="user">
<input style="float: right;" type="submit" value="发表">
</form>
这是我php的代码
<?php
echo "POST: ";
var_dump($_POST);
echo "<br />";
echo "GET: ";
var_dump($_GET);
echo "<br />";
echo "REQUEST: ";
var_dump($_REQUEST);
echo "<br />";
?>
当h5中使用post方法时,打印:
POST: array(0) { }
GET: array(0) { }
REQUEST: array(0) { }
当h5中使用get方法时,打印:
POST: array(0) { }
GET: array(2) { ["content"]=> string(6) "内容" ["user"]=> string(9) "用户名" }
REQUEST: array(2) { ["content"]=> string(6) "内容" ["user"]=> string(9) "用户名" } 测试了一下php5.5和7.0下,没你说的问题 不知道问题在哪啊,我打印了一下$_SERVER变量,您看看能看出什么问题吗
前端h5使用的是post方法
SERVER: array(34) {
["USER"]=> string(3) "www"
["HOME"]=> string(9) "/home/www"
["HTTP_CONNECTION"]=> string(10) "keep-alive"
["HTTP_ACCEPT_ENCODING"]=> string(13) "gzip, deflate"
["HTTP_ACCEPT_LANGUAGE"]=> string(5) "zh-cn"
["HTTP_USER_AGENT"]=> string(119) "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/602.3.12 (KHTML, like Gecko) Version/10.0.2 Safari/602.3.12"
["HTTP_ACCEPT"]=> string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
["HTTP_UPGRADE_INSECURE_REQUESTS"]=> string(1) "1"
["HTTP_ORIGIN"]=> string(4) "null"
["HTTP_HOST"]=> string(14) "172.16.157.133"
["PHP_ADMIN_VALUE"]=> string(27) "open_basedir=/:/tmp/:/proc/"
["REDIRECT_STATUS"]=> string(3) "200"
["SERVER_NAME"]=> string(1) "_"
["SERVER_PORT"]=> string(2) "80"
["SERVER_ADDR"]=> string(14) "172.16.157.133"
["REMOTE_PORT"]=> string(5) "50956"
["REMOTE_ADDR"]=> string(12) "172.16.157.1"
["SERVER_SOFTWARE"]=> string(12) "nginx/1.10.2"
["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1"
["REQUEST_SCHEME"]=> string(4) "http"
["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1"
["DOCUMENT_ROOT"]=> string(21) "/home/wwwroot/default"
["DOCUMENT_URI"]=> string(15) "/test/index.php"
["REQUEST_URI"]=> string(6) "/test/"
["SCRIPT_NAME"]=> string(15) "/test/index.php"
["CONTENT_LENGTH"]=> string(0) ""
["CONTENT_TYPE"]=> string(0) ""
["REQUEST_METHOD"]=> string(3) "GET"
["QUERY_STRING"]=> string(0) ""
["SCRIPT_FILENAME"]=> string(36) "/home/wwwroot/default/test/index.php" ["FCGI_ROLE"]=> string(9) "RESPONDER"
["PHP_SELF"]=> string(15) "/test/index.php"
["REQUEST_TIME_FLOAT"]=> float(1485141932.3316)
["REQUEST_TIME"]=> int(1485141932)
}
回复 5# 的帖子
这上面的信息是正常的
页:
[1]