在PHP中使用函数$ _GET时,我总是变得“未定义”,这是为什么?

| 当我在前一页中使用
print($_GET[\'user_username\']);
时,仍继续打印出
undefined
。页面的URL是“ 2”。为什么会这样呢?     
已邀请:
可能是错误设置,此处已解决类似问题。     
$ _GET手册说   关联变量数组   通过传递到当前脚本   网址参数。 首先确保该元素存在
<?php
  echo !isset($_GET[\"user_username\"]) ? \"undefined\" : $_GET[\"user_username\"];
?>
或对
$_GET
数组尝试ѭ4to来查看是否存在带有
user_username
键的元素。
var_dump($_GET);
您的要求是这样吗? http://www.mydomain.com/something.php?user_username=something     
试试这个代码:
print_r($_GET); 
您将使用get以数组格式获取所有传递的元素。然后您可以检查它。它还有助于更好地进行多次调试。     

要回复问题请先登录注册