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 标头位置重定向不起作用 - 为什么?
基础教程推荐
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 如何替换eregi() 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
