dongqi9125 2016-03-17 14:05
浏览 77

参数从$ _POST数组中消失

Today I came across the strange behaviour with PHP _POST array. When submitting form fields named as multidimensional array PHP supports, the POST is filled with only the first value from array. Found this on PHP 5.3.8 (SLES 11 SP2). The same code works normally on all other systems I have access to including PHP 5.2, 5.3.18, and 5.4. Here is a test case:

<form method="POST" action="test.php">
<input type="text" name="single" value="sss"/><br>
<input type="text" name="multi[a]" value="AAA"/><br>
<input type="text" name="multi[b]" value="BBB"/><br>
<input type="text" name="single2" value="CCC"/><br>
<input type="submit">
</form>
<?php
$raw_post = file_get_contents('php://input');
print $raw_post;
phpinfo(INFO_VARIABLES);

After submitting this I get the following in raw data:

single=sss&multi%5Ba%5D=AAA&multi%5Bb%5D=BBB&single2=CCC

But $_POST array is filled only with first value from "multi", $_POST['multi'] provides:

Array
(
    [a] => AAA
)

Does anybody know why this can happen?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡等级和折扣规则
    • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
    • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
    • ¥15 gdf格式的脑电数据如何处理matlab
    • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
    • ¥100 监控抖音用户作品更新可以微信公众号提醒
    • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
    • ¥70 2048小游戏毕设项目
    • ¥20 mysql架构,按照姓名分表
    • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分