【问题标题】:Header already sent error message on LIVE server [duplicate]标头已在 LIVE 服务器上发送错误消息 [重复]
【发布时间】:2015-04-20 03:33:11
【问题描述】:

将我的 PHP 项目上传到实时服务器后,我在访问某些页面时收到此错误消息。

警告:无法修改标头信息 - 标头已由 (输出开始于 /home/mychoice/public_html/version-2/dashboard/includes/header.inc.html:14) 在 /home/mychoice/public_html/version-2/dashboard/modules/_modify_admin_select.inc.php 在第 63 行

但是在本地主机上运行时,我没有收到此错误,并且每个脚本都可以正常运行。

我已经检查了空格、PHP 开始结束标记和没有 BOM 的编码。

但我还是想不通。

这是我的header.inc.html 页面:

<?php # -- header.html
// This page begins the HTML header for the site.

// Check for a $page_title value:
if (!isset($page_title)) $page_title = 'Computer store | Control Panel';
?><!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title><?php echo $page_title; ?></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="icon" type="image/ico" href="favicon.ico"/>
        <link rel="apple-touch-icon" sizes="152x152" href="apple-touch-icon-precomposed.png" />

        <link rel="stylesheet" href="css/styles.css">

        <script src="js/vendor/modernizr.min.js"></script>
    </head>
    <body>
      <!--[if lt IE 7]>
        <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
      <![endif]-->

            <!-- End of header. -->

【问题讨论】:

  • @Dagon。在我问这个之前,我检查了那个问题,并根据那里提供的答案尝试了几乎所有的东西。但它在本地主机中工作,但不在实时服务器中。
  • 我看到很多输出并且没有调用 header ..
  • @Dagon,您能否解释一下您的最后评论。其实我不知道你说了什么。提前致谢。
  • 我已经用UTF-8 without BOM 保存了这个文件。我还尝试删除此文件中的所有PHP。但我仍然可以收到错误消息。
  • 您发布的代码中没有使用header

标签: php html http-headers


【解决方案1】:

尽量用javascript代替header

<script>
vax x='index.php';

window.location.href=x;
</script>

【讨论】:

    猜你喜欢
    • 2011-07-04
    • 2015-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多