dsu89430 2018-03-11 02:02
浏览 177

var_dump返回的空数组($ _ POST); 虽然不是var_dump($ _ GET);

I am running PHP 7.0.22 on two ubuntu 16.04.1 LTS servers: a web server and an app server. They are both instances of AWS EC2.

When I have the following code on the app server

<form action="http://example.com/uploadFiles.php" method="get" enctype="multipart/form-data">
    <label for="file" style="font-size:5mm; font-family:times-new-roman">Select up to 20 filenames:</label>
    <input type="file" name="file[]" id="file" multiple="multiple"/></br>
    <input type="submit" name="submit[]" value="submit" />
    <input type="hidden" id="LoggedIn" name="LoggedIn" value="<?php echo $_SESSION['LoggedIn'] ?>">
    <input type="hidden" id="setName" name="setName" value="<?php echo $setName ?>">
    <input type="hidden" id="UserName" name="UserName" value="<?php echo $_SESSION['UserName'] ?>">
</form>

and the following code in uploadFiles.php on the web server

<html>
<body>

<?php  require("menu.php"); ?>
<?php
 var_dump($_GET);
?>

</body>
</html>

I get

array(5) { ["file"]=> array(1) { [0]=> string(32) "file.name" } ["submit"]=> array(1) { [0]=> string(6) "submit" } ["LoggedIn"]=> string(1) "1" ["setName"]=> string(4) "test" ["UserName"]=> string(12) "OtagoHarbour" }

However, if I have the following code on the app server

<form action="http://example.com/uploadFiles.php" method="post" enctype="multipart/form-data">
    <label for="file" style="font-size:5mm; font-family:times-new-roman">Select up to 20 filenames:</label>
    <input type="file" name="file[]" id="file" multiple="multiple"/></br>
    <input type="submit" name="submit[]" value="submit" />
    <input type="hidden" id="LoggedIn" name="LoggedIn" value="<?php echo $_SESSION['LoggedIn'] ?>">
    <input type="hidden" id="setName" name="setName" value="<?php echo $setName ?>">
    <input type="hidden" id="UserName" name="UserName" value="<?php echo $_SESSION['UserName'] ?>">
</form>

and the following code in uploadFiles.php on the web server

<html>
<body>

<?php  require("menu.php"); ?>
<?php
 var_dump($_POST);
?>

</body>
</html>

I get

array(0) { }

Is there a way to get what I am getting with GET using POST?

I do not know of this is relevant but I did not have this problem before I set SSL up on my website.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 #MATLAB仿真#车辆换道路径规划
    • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
    • ¥15 数据可视化Python
    • ¥15 要给毕业设计添加扫码登录的功能!!有偿
    • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
    • ¥15 微信公众号自制会员卡没有收款渠道啊
    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘