<small id='j2rcA'></small><noframes id='j2rcA'>

    1. <tfoot id='j2rcA'></tfoot>

      <i id='j2rcA'><tr id='j2rcA'><dt id='j2rcA'><q id='j2rcA'><span id='j2rcA'><b id='j2rcA'><form id='j2rcA'><ins id='j2rcA'></ins><ul id='j2rcA'></ul><sub id='j2rcA'></sub></form><legend id='j2rcA'></legend><bdo id='j2rcA'><pre id='j2rcA'><center id='j2rcA'></center></pre></bdo></b><th id='j2rcA'></th></span></q></dt></tr></i><div id='j2rcA'><tfoot id='j2rcA'></tfoot><dl id='j2rcA'><fieldset id='j2rcA'></fieldset></dl></div>

    2. <legend id='j2rcA'><style id='j2rcA'><dir id='j2rcA'><q id='j2rcA'></q></dir></style></legend>
      • <bdo id='j2rcA'></bdo><ul id='j2rcA'></ul>

      PHP - 无法修改标头信息

      PHP - Cannot modify header information(PHP - 无法修改标头信息)

        <tfoot id='70tza'></tfoot>
      • <small id='70tza'></small><noframes id='70tza'>

      • <i id='70tza'><tr id='70tza'><dt id='70tza'><q id='70tza'><span id='70tza'><b id='70tza'><form id='70tza'><ins id='70tza'></ins><ul id='70tza'></ul><sub id='70tza'></sub></form><legend id='70tza'></legend><bdo id='70tza'><pre id='70tza'><center id='70tza'></center></pre></bdo></b><th id='70tza'></th></span></q></dt></tr></i><div id='70tza'><tfoot id='70tza'></tfoot><dl id='70tza'><fieldset id='70tza'></fieldset></dl></div>

                <tbody id='70tza'></tbody>
                <bdo id='70tza'></bdo><ul id='70tza'></ul>
                <legend id='70tza'><style id='70tza'><dir id='70tza'><q id='70tza'></q></dir></style></legend>
              • 本文介绍了PHP - 无法修改标头信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                这个错误我快疯了:无法修改标头信息 - 标头已由...发送.

                I am going crazy with this error: Cannot modify header information - headers already sent by...

                请注意,我知道谷歌和堆栈溢出的海量结果.我的问题是我构建页面的方式.为了将 html 与 php 分开,我使用包含文件.因此,例如,我的页面如下所示:

                Please note that I know about the gazillion results on google and on stack overflow. My problem is the way I've constructed my pages. To keep html separate from php, I use include files. So, for example, my pages look something like this:

                <?php 
                require_once('web.config.php'); 
                ?>
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml">
                <head>
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                <title>Login</title>
                <link rel="shortcut icon" href="images/favicon.gif"/>
                <link rel="shortcut icon" href="images/favicon.ico"/>
                <link rel="stylesheet" type="text/css" href="<?php echo SITE_STYLE; ?>"/>
                </head>
                <body>
                <div id="page_effect" style="display:none;">
                <?php require_once('./controls/login/login.control.php'); ?>
                </div>
                </body>
                </html>
                

                所以,当我的 php 文件包含在内时,标头已经发送.

                So, by the time my php file is included, the header is already sent.

                部分包含文件如下所示:

                Part of the include file looks like this:

                // redirect to destination
                if($user_redirect != 'default')
                {
                    header('Location:'.$user_redirect);
                }
                elseif($user_redirect == 'default' && isset($_GET['ReturnURL']))
                {
                    $destination_url = $_GET['ReturnURL'];
                    header('Location:'.$destination_url);
                }
                else
                {
                    header('Location:'.SITE_URL.'login.php');
                }
                

                但我不知道如何解决这个问题.我不能在输出之前重定向标头,所以打开 输出缓冲 是我唯一能做的.自然地,它可以正常工作 - 但不得不依赖它只是很臭.

                But I can't figure out how to work around this. I can't have the header redirect before the output so having output buffering on is the only thing I can do. Naturally it works fine that way - but having to rely on that just stinks.

                如果 PHP 有另一种重定向方式或有额外的参数告诉它清除缓冲区,那就太好了.

                It would be nice if PHP had an alternative way to redirect or had additional parameters to tell it to clear the buffer.

                推荐答案

                header 语句前是否有 echo/print 语句?这可能会导致此错误.

                Is there any echo/print statement before the header statements? That could cause this error.

                这篇关于PHP - 无法修改标头信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                <small id='MPmTB'></small><noframes id='MPmTB'>

              • <i id='MPmTB'><tr id='MPmTB'><dt id='MPmTB'><q id='MPmTB'><span id='MPmTB'><b id='MPmTB'><form id='MPmTB'><ins id='MPmTB'></ins><ul id='MPmTB'></ul><sub id='MPmTB'></sub></form><legend id='MPmTB'></legend><bdo id='MPmTB'><pre id='MPmTB'><center id='MPmTB'></center></pre></bdo></b><th id='MPmTB'></th></span></q></dt></tr></i><div id='MPmTB'><tfoot id='MPmTB'></tfoot><dl id='MPmTB'><fieldset id='MPmTB'></fieldset></dl></div>
                  <tbody id='MPmTB'></tbody>
              • <legend id='MPmTB'><style id='MPmTB'><dir id='MPmTB'><q id='MPmTB'></q></dir></style></legend>
                  <bdo id='MPmTB'></bdo><ul id='MPmTB'></ul>

                  <tfoot id='MPmTB'></tfoot>