通过阵列失去了所有,但第一要素 [英] Passed arrays lose all but first element
问题描述
我有一个奇怪的问题。我最近迁移我的应用程序从我的本地的XAMPP安装到SUSE Enterprise Server的11和一切工作,但这样一件事让我发疯,我无法找到一个解决方案。
在传递数组或者通过GET或POST使用此语法:
search_dggs.php latmin [] = 52.447529&放大器; latmin [] = 22&安培; Lonmin公司= 17.56和放大器; lonmax = 22.16
我只得到latmin的第一要素。你要知道,这仅仅是一个简单的例子,我想发生在其他地方后,错误的阵列的传递是必要的。
的print_r($ _ SERVER [QUERY_STRING]);
输出
latmin [] = 52.447529&放大器; latmin [] = 22&安培; Lonmin公司= 17.56和放大器; lonmax = 22.16
但
的print_r($ _ GET);
给
阵列
(
[latmin] =>排列
(
[0] => 52.447529
) [Lonmin公司] => 17.56
[lonmax] => 22.16
)
完全同样的情况,所有的POST请求。
我使用PHP版本5.3.8。
我想这个问题是一些服务器的配置,但我无法找到有关此问题的任何事情。
回应评论:
如果我提交的任何数量的变量同样的情况。
parse_str($ _ SERVER [QUERY_STRING]);
的print_r($ latmin);
给
阵列
(
[0] => 52.447529
)
php.ini中可以发现这里
您应该能够看到活动的行为,<一个href=\"http://awst.ipf.tuwien.ac.at/test.php?latmin%5B%5D=52.447529&latmin%5B%5D=22&lonmin=23&lonmax=22.16\"相对=nofollow>这里
这个PHP文件的源文件
&LT; PHP $测试=latmin [] = 52.447529&放大器; latmin [] = 22&安培; Lonmin公司= 23安培; lonmax = 22.16;
parse_str($测试);
的print_r($ latmin);
的phpinfo();?&GT;
那么我的系统管理进行了系统更新并重新启动,现在的问题是固定的。没有配置文件被更改。
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.
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
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"]);
outputs
latmin[]=52.447529&latmin[]=22&lonmin=17.56&lonmax=22.16
but
print_r($_GET);
gives
Array
(
[latmin] => Array
(
[0] => 52.447529
)
[lonmin] => 17.56
[lonmax] => 22.16
)
Exactly the same happens with all POST requests.
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.
Response to comments:
The same happens if I submit any number of variables.
parse_str($_SERVER["QUERY_STRING"]);
print_r($latmin);
gives
Array
(
[0] => 52.447529
)
php.ini can be found here
You should be able to see the behaviour in action here
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.
这篇关于通过阵列失去了所有,但第一要素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!