PHP header location-redirect doesn#39;t work - why?(PHP 标头位置重定向不起作用 - 为什么?)
问题描述
这是我的文件.我想让它重定向,但没有任何反应.为了检查发生了什么,我在标题部分之前添加了一个 echo.
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.
它既不会抛出错误也不会重定向到 index.php.怎么了?我已经打开/关闭输出缓冲,但没有任何东西使它重定向.我能做什么?
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();
?>
谢谢
推荐答案
我提醒自己,我在实际测试环境中安装了 xDebug,经过谷歌搜索后,我发现了这个站点:http://bugs.xdebug.org/view.php?id=532
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
因此,我将下载最新版本的 xDebug 并相应地为新文件更改 php.ini,一切都变得很完美.正在发送标头 - 重定向已完成并显示错误.
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.
感谢大家的帮助!
这篇关于PHP 标头位置重定向不起作用 - 为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PHP 标头位置重定向不起作用 - 为什么?
- PHP - if 语句中的倒序 2021-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
