2017-05-24 88 views
0

Page1.php代码;PHP重定向不显示页面内容重定向到

... 
header('Location: editt.php?msg=landing&msisdn='.$msisdn); 
... 

page2.php code;

$msisdn = $_GET['msisdn']; 
$msg = $_GET['msg']; 
echo 'Page 2 Content '.$msisdn; 
+0

推测'page2.php'是'editt.php'? – apokryfos

+0

对不起,要求显而易见,但...如果从地址栏直接加载页面显示是否正确显示? –

+0

它是page2还是editt?! –

回答

0

的一段代码您发布的作品,也许在你的代码的其余部分有header()之前的一些HTML输出,这也可以是一些包含的文件,如果有一些。

UPDATE:

同一个问题的一些有用的答案可以在这里找到:

php-header-redirect-not-working

+0

不,没有html输出,我只有在它之前有一个API调用 – Givelasdougmore

+0

有一些有用的答案[here](https:// stackoverflow .com/questions/423860/php-header-redirect-not-working),它可能有帮助。 – jirarium

+0

刚刚尝试过。不工作。 @jirarium – Givelasdougmore

0

为什么不使用头作为数据的容器:

header('msg: msgValue'); 
header('msisdn: msisdnValue'); 
header('Location: editt.php'); 

在编辑.php

$headers = apache_request_headers(); 

foreach ($headers as $header => $value) { 
    echo "$header: $value <br />\n"; 
} 
+0

我仍然有同样的问题。我已经完成了它的方式,它在其他页面中起作用。当我在第1页上做同样的事情时,它不起作用 – Givelasdougmore

+0

我认为你有另一个问题在某处,请过完整的代码 –