简体   繁体   English

$ _GET返回空值

[英]$_GET Returning Null

I feel like I'm doing some simple, stupid mistake. 我感觉自己在犯一些简单,愚蠢的错误。 I have a very simple page that I'm using for testing. 我有一个非常简单的页面用于测试。 But I can't figure out why this doesn't work. 但是我不知道为什么这行不通。 Been searching for an answer for over an hour. 一个多小时以来一直在寻找答案。

I realize that I could take the $_SERVER['QUERY_STRING'] and parse it, but I would prefer to find out what I'm doing wrong. 我意识到我可以接受$ _SERVER ['QUERY_STRING']并对其进行解析,但我希望找出我做错了什么。

Maybe another pair of eyes can spot the problem. 也许另一双眼睛可以发现问题所在。

Thanks. 谢谢。

PS In case this matters, this is on IIS (Windows Server 2008). PS如果这很重要,请使用IIS(Windows Server 2008)。


On a URL with a query string, the $_GET is returning null. 在带有查询字符串的URL上,$ _ GET返回null。
So, on this URL: 因此,在此URL上:

http://www...../test.php?id=test

where test.php contains: 其中test.php包含:

<html><body>
<?php
if (isset($_get['id'])){
    echo "set";
}else
{
    echo "not set";
}
echo "<br>";
var_dump($_get['id']); 
echo "<br>";
var_dump($_request['id']);
echo "<br>";
var_dump($_SERVER['QUERY_STRING']);
echo "<br>";
print_r($_REQUEST);
?>
</body></html>

And my results are: 我的结果是:

not set
NULL 
NULL 
string(13) "id=test" 
Array ( [id] => test )

$_get != $_GET $_get != $_GET

PHP uses case-sensitive variable names. PHP使用区分大小写的变量名。 You always have to match the exact case. 您始终必须匹配确切的情况。

您应该使用$_GET而不是$_get

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM