Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将值传递给header()函数?_Php_Parsing_Header - Fatal编程技术网

Php 如何将值传递给header()函数?

Php 如何将值传递给header()函数?,php,parsing,header,Php,Parsing,Header,我必须将用户重定向到不同的页面。 这就是我现在拥有的 header('Location: http://www.example.com/$confirmpage') 但它不起作用。它将它们重定向到$confirmpage(未检索到值),并给出404错误 当我使用 echo "<script>document.location='http://www.example.com/$confirmpage';</script>"; echo“document.location

我必须将用户重定向到不同的页面。 这就是我现在拥有的

header('Location: http://www.example.com/$confirmpage')
但它不起作用。它将它们重定向到$confirmpage(未检索到值),并给出404错误

当我使用

echo "<script>document.location='http://www.example.com/$confirmpage';</script>";
echo“document.location=”http://www.example.com/$confirmpage';“;
它起作用了

但出于某些原因,我不得不使用header()函数

header("Location: http://www.example.com/$confirmpage")
如果要引用php字符串中的变量,必须使用
而不是

如果要引用php字符串中的变量,必须使用
而不是


根据
$confirmpage
的内容,您可能会想要它。根据
$confirmpage
的内容,您可能会想要它。