传递的数组丢失了除第一个元素之外的所有元素

2022-01-04 00:00:00 arrays post get php

我有一个奇怪的问题.我最近将我的应用程序从我的本地 xampp 安装迁移到 SUSE Enterprise Server 11,一切正常,但这一件事让我发疯,我找不到解决方案.

I have a strange problem. I recently migrated my application from my local xampp installation to a SUSE Enterprise Server 11 and everything is working but this one thing drives me crazy and I can't find a solution.

使用以下语法通过 GET 或 POST 传递数组时:

When passing arrays either through GET or POST using this syntax:

search_dggs.php?latmin[]=52.447529&latmin[]=22&lonmin=17.56&lonmax=22.16

我只得到 latmin 的第一个元素.请注意,这只是我在其他需要传递数组的地方发生错误后尝试的简单示例.

I only get the first element of latmin. Mind you that this is only a simple example I tried after the error occurred in other places where the passing of arrays is necessary.

print_r($_SERVER["QUERY_STRING"]); 

输出

latmin[]=52.447529&latmin[]=22&lonmin=17.56&lonmax=22.16

但是

print_r($_GET);

给予

Array
(
    [latmin] => Array
        (
            [0] => 52.447529
        )

    [lonmin] => 17.56
    [lonmax] => 22.16
)

完全相同的情况发生在所有 POST 请求中.

Exactly the same happens with all POST requests.

我使用的是 PHP 5.3.8 版.我猜是一些服务器配置的问题,但我找不到有关此问题的任何信息.

I'm using PHP Version 5.3.8. I guess the problem is some Server configuration but I couldn't find anything about this problem.

回复评论:

如果我提交任意数量的变量,也会发生同样的情况.

The same happens if I submit any number of variables.

parse_str($_SERVER["QUERY_STRING"]);
print_r($latmin);

给予

Array
(
    [0] => 52.447529
)

php.ini 可以在这里

php.ini can be found here

您应该能够看到实际的行为 这里

You should be able to see the behaviour in action here

这个php文件的源文件是

The source file of this php file is

<?php

    $test="latmin[]=52.447529&latmin[]=22&lonmin=23&lonmax=22.16";
    parse_str($test);
    print_r($latmin);
    phpinfo();

?>

推荐答案

好吧,我的系统管理员进行了系统更新并重新启动,问题现已解决.未更改任何配置文件.

Well my System Admin did a system update and reboot and the issue is now fixed. No configuration files were changed.

相关文章