未将PHP变量传递到url

未将PHP变量传递到url,php,header,Php,Header,我试图将变量$userhash传递到url,但由于某些原因,它无法工作。这是我的密码: header("Location: home.php?userhash=$userhash"); 我知道userhash有一个值,因为如果我注释掉标题,我可以回显它并查看它 我试过这样做: header("Location: home.php?userhash=test"); 而且 header("Location: home.php?userhash='test'"); 但每次我看到它时,它都会将我

我试图将变量
$userhash
传递到url,但由于某些原因,它无法工作。这是我的密码:

header("Location: home.php?userhash=$userhash");
我知道
userhash
有一个值,因为如果我注释掉标题,我可以回显它并查看它

我试过这样做:

header("Location: home.php?userhash=test"); 
而且

header("Location: home.php?userhash='test'");

但每次我看到它时,它都会将我重定向到下一页,url总是像这样
home.php?userhash=
。我做错了什么

在收割台后面放一个出口

header('Location: /home.php?username='.$username);
exit;
查看有关位置的部分:

尝试以下代码

header("Location: home.php?userhash=".$userhash);
exit;

你有访问权限吗?Post
home.php
code不太相关,但在语法上是标题('Location:home.php?userhash='。$userhash);优于标头(“Location:home.php?userhash=$userhash”);出口;之后也会阻止任何其他代码运行,不管可能性有多大。我几乎解决了这个问题,不是在login中,而是在my home.php中,我想我将url变量设置为nothing。谢谢谢谢我爱荣誉:p如果你的问题真的得到了回答,请接受答案