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

2023-10-13php开发问题
1

本文介绍了传递的数组丢失了除第一个元素之外的所有元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我有一个奇怪的问题.我最近将我的应用程序从我的本地 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.

这篇关于传递的数组丢失了除第一个元素之外的所有元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

PHP实现DeepL翻译API调用
DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以...
2025-08-20 php开发问题
168

PHP通过phpspreadsheet导入Excel日期数据处理方法
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的...
2024-10-23 php开发问题
287

mediatemple - 无法使用 codeigniter 发送电子邮件
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)...
2024-08-23 php开发问题
11

Laravel Gmail 配置错误
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)...
2024-08-23 php开发问题
16

将 PHPMailer 用于 SMTP 的问题
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)...
2024-08-23 php开发问题
4

关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)...
2024-08-23 php开发问题
17