使用GET方法在header()函数中发送多个值

时间:2013-01-18 07:13:35

标签: php header get

我的问题是关于header()功能。我试图通过这个函数发送2个变量,如下所示:

header("Location:index.php?variable_1='true'&variable_2='false'");

我认为它是转义&的问题,但我只是使用&. Also, first variable gets initialized and I can acquire it by calling $ _ GET ['variable_1']来尝试它,但第二个没有存在且未初始化。

所以我的问题是,我可以通过GET方法通过header()函数发送多个值吗?

感谢您的时间!

2 个答案:

答案 0 :(得分:5)

是的,你可以这样做

header("Location: index.php?variable_1=true&variable_2=false");

你不需要使用''this

答案 1 :(得分:1)

试试这个:

header("Location:index.php?variable_1=true&variable_2=false");
相关问题