VPS侦探论坛

 找回密码
 注册
查看: 3693|回复: 5

lnmp1.4 $_POST 为空

[复制链接]
发表于 2017-1-22 10:46:20 | 显示全部楼层 |阅读模式

在ubuntu16.10的环境下 安装lnmp1.4 后,当前台使用get方法请求时,$GET有值,当前台使用post方法请求时,$POST无值;获取不到,为什么
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2017-1-22 13:00:39 | 显示全部楼层


基本常见的程序我们都测试过没问题
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2017-1-22 16:41:10 | 显示全部楼层

这是我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) "用户名" }
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2017-1-22 17:27:03 | 显示全部楼层



测试了一下php5.5和7.0下,没你说的问题
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2017-1-23 11:30:14 | 显示全部楼层

不知道问题在哪啊,我打印了一下$_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)
}

军哥运维代购:http://shop63846532.taobao.com/

发表于 2017-1-23 17:08:16 | 显示全部楼层

回复 5# 的帖子


这上面的信息是正常的
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-27 23:29 , Processed in 0.026779 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表