PHP标题位置重定向不起作用 - 为什么? [英] PHP header location-redirect doesn't work - why?

查看:135
本文介绍了PHP标题位置重定向不起作用 - 为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的档案。我想让它重定向,但没有任何反应。要检查发生了什么,我在标题部分之前添加了一个回显。

它既不会引发错误,也不会重定向到index.php。哪里不对?
我打开/关闭了输出缓冲,但没有任何东西让它重定向。我能做什么?

 < ;? 
error_reporting(E_ALL);
echo'这是一个错误';

header(Location:login.php);
die();
?>



由于


解决方案

我提醒自己,我已经在实际的测试环境中安装了XDebug和谷歌上搜索之后,我发现这个网站:的 http://bugs.xdebug.org/view.php?id=532



所以我会下载xDebug的最新版本,并相应地更改了php.ini文件,所有内容都像魅力一样。标题正在发送 - 重定向完成并显示错误。



感谢大家的帮助!


Here's my file. I want to make it redirect, but nothing happens. To check out what is going on, I added an echo before the header part.

It neither throws an error or redirect to index.php. What is wrong? I have turned output buffering on/off, but nothing makes it redirect. What can I do?

<?
error_reporting(E_ALL);
echo 'This is an error';

header("Location: login.php");
die();
?>

Thanks

解决方案

I reminded myself that I had xDebug installed on the actual test environment and after googling it, I found this site: http://bugs.xdebug.org/view.php?id=532

So I'll downloaded the last version of xDebug and changed the php.ini accordingly for the new file and everything works out like a charm. Headers are being sent - the redirecetion is done and errors are displayed.

Thanks everybody for your help!

这篇关于PHP标题位置重定向不起作用 - 为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆