duangang2825 2013-07-25 15:50
浏览 59
已采纳

警告:无法修改标头信息 - 已经由(输出)发送的标头[重复]

This question already has an answer here:

I'm getting this error again and again i try everything but i can't found solution

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxx/xxxx/forum/index.php:90) in /home/pappu/public_html/forum/index.php on line 93

here is my index.php code

<?php
include_once("connect.php");
session_start();
?>
<html>
<head>
<title>MyForum</title>
<style type="text/css">
body {
background-color: #333;
margin-top: 150px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
}
.content {
background-color: #666;
width: 960px;
margin-right: auto;
margin-left: auto;
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
padding: 20px;
}
.content .categories {
width: 700px;
background-color: #333;
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
margin: 0px;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
color: #FFF;
}
.categories .community_heading {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-variant: normal;
text-transform: capitalize;
color: #CCC;
margin: 0px;
padding-top: 7px;
padding-right: 7px;
padding-bottom: 7px;
padding-left: 14px;
font-size: 18px;
font-weight: bold;
}
.content .categories hr {
background-color: #666;
height: 3px;
border: 0px;
width: 700px;
margin: 0px;
}

.content .categories .cat_links {
border-bottom-width: thin;
border-bottom-style: solid;
border-bottom-color: #000;
padding-top: 7px;
padding-right: 7px;
padding-bottom: 7px;
padding-left: 14px;
font-size: 14px;
color: #000;
}
.content .categories .cat_a {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 18px;
font-variant: normal;
text-transform: capitalize;
color: #777;
text-decoration: none;
}
.content .categories .cat_a:hover {
text-decoration: underline;
color: #DDD;
}
.content .categories .desc {
margin: 0px;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #CCC;
}
</style>
</head>
<body>
<?php
if(!isset($_SESSION['password']))
{
include_once("Location:header.php");
}
else
{
header("Location:member.php");
}
?>
<div class="content">
<div class="categories">
<h3 class="community_heading">Community</h3>
<hr />
<?php
$query = "SELECT * FROM categories ORDER BY cat_id ASC";
$result = mysql_query($query) or die(mysql_error());
$categories = "";
if(mysql_num_rows($result) > 0 )
{
while($row = mysql_fetch_array($result))
{
$cat_id = $row['cat_id'];
$cat_title = $row['cat_title'];
$cat_desc = $row['cat_description'];
$categories .="
<div class='cat_links'>
<a href='view_category?cid=".$cat_id."' class='cat_a'>$cat_title</a>
<p class='desc'>$cat_desc</p>
</div>";
}
echo $categories ;
}
else 
{
}
?>
</div>
</div>
</body>
</html>
</div>
  • 写回答

1条回答 默认 最新

  • dtvp3625 2013-07-25 15:53
    关注

    You can't call Header() after including ANY code that is outputted to the page. You need to rewrite what you are doing so the Header() call is above all the HTML code.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)