PHP的$ _GET问题 [英] Php $_GET issue
问题描述
的foreach($ _ GET为$字段=> $标签)
{
$ datarray [] = $ _ GET [$场]
回声$ _GET [$现场];
回声< BR>中;
}
的print_r($ datarray);
这是我得到的输出。我看到的数据是那里datarray但是当
我回声$ _GET [$场]
我只得到阵列
但的print_r($ datarray)
打印所有的数据。任何想法,我怎么拉这些价值?
输出
阵列(
[0] =>阵列(
[0] => Grade1
[1] => LN
[2] =>北美
[3] => yuiyyu
[4] => iuy
[5] => uiyui
[6] =>锐
[7] => uiy
[8] => 0:0:5
)
)
编辑:当我完成你的测试,这里是最后的网址:
<一个href=\"http://hofstrateach.org/Roberto/process.php?keys=Grade1&keys=Nathan&keys=North%20America&keys=5&keys=3&keys=no&keys=foo&keys=blat&keys=0%3A0%3A24\" rel=\"nofollow\">http://hofstrateach.org/Roberto/process.php?keys=Grade1&keys=Nathan&keys=North%20America&keys=5&keys=3&keys=no&keys=foo&keys=blat&keys=0%3A0%3A24
这可能是一个错误的URL。当您在查询中传递重复键,PHP使他们的数组。上述网址也许应该是这样的:
<一个href=\"http://hofstrateach.org/Roberto/process.php?grade=Grade1&schoolname=Nathan®ion=North%20America&answer\" rel=\"nofollow\">http://hofstrateach.org/Roberto/process.php?grade=Grade1&schoolname=Nathan®ion=North%20America&answer[]=5&answer[]=3&answer[]=no&answer[]=foo&answer[]=blat&time=0%3A0%3A24
这将为大多数领域的各个条目,使$ _GET ['答案']是由用户提供的答案的数组。
底线:解决您的Flash文件
foreach ($_GET as $field => $label)
{
$datarray[]=$_GET[$field];
echo "$_GET[$field]";
echo "<br>";
}
print_r($datarray);
This is the output I am getting. I see the data is there in datarray but when
I echo $_GET[$field]
I only get "Array"
But print_r($datarray)
prints all the data. Any idea how I pull those values?
OUTPUT
Array (
[0] => Array (
[0] => Grade1
[1] => ln
[2] => North America
[3] => yuiyyu
[4] => iuy
[5] => uiyui
[6] => yui
[7] => uiy
[8] => 0:0:5
)
)
EDIT: When I completed your test, here was the final URL:
This is probably a malformed URL. When you pass duplicate keys in a query, PHP makes them an array. The above URL should probably be something like:
http://hofstrateach.org/Roberto/process.php?grade=Grade1&schoolname=Nathan®ion=North%20America&answer[]=5&answer[]=3&answer[]=no&answer[]=foo&answer[]=blat&time=0%3A0%3A24
This will create individual entries for most of the fields, and make $_GET['answer'] be an array of the answers provided by the user.
Bottom line: fix your Flash file.
这篇关于PHP的$ _GET问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!