我有一個PHP代碼。當我運行的代碼,它的工作正常,但出現一些警告,那是 - Warning: Cannot modify header information - headers already sent by (output started at /home/fundumob/public_html/app_create/nav_class.php:119) in /home/fundumob/public_html/app_create/profile.php on line 32
忽略PHP警告
我該怎麼辦? ,我的代碼如下..
<?php session_start(); error_reporting(E_ALL^E_WARNING);?>
<?php
//include("local_config.php");
include("lib/config.php");
include("nav_class.php");
$obj=new navig();
if(isset($_SESSION['user_id']))
{
$user_id=$_SESSION['user_id'];
$pic="select Picture from Profile where user_id=$user_id ";
$pic_result=mysql_query($pic) or die ("sorry".$pic);
$count=mysql_num_fields($pic_result);
if($count==1)
{
$rows=mysql_fetch_row($pic_result);
$_SESSION['picture']=$rows[0];
$profile_pic=$_SESSION['picture'];
$photo="profile/".$profile_pic;
}
else
{
$photo="profile/img.jpg";
}
}
else
{
header("location:index.php?er=3");
}
?>
<div id="templatemo_header_wrapper">
<div id="templatemo_header">
<div id="site_logo"></div>
<div id="menu_nav" >
<ul id="css3menu1" class="topmenu">
<li class="topfirst"><a href="profile.php?apps=1" style="height:15px;line-
height:15px;">Dashboard</a></li>
<li class="topmenu"><a href="#" style="height:15px;line-height:15px;">Profile</a>
</li>
<li class="topmenu"><a href="#" style="height:15px;line-height:15px;">Settings</a>
</li>
<li class="toplast"><a href="#" style="height:15px;line-height:15px;">Prateek
</ul>
</div> </div><!-- end of header -->
</div>
<div id="tempatemo_content_wrapper">
<div id="templatemo_content" align="center">
<div class="recent_projects">
<div align="right">
<table width="50%" border="0">
<tr>
<td width="85%" height="20" style="border-right:1px solid #D0D0D0;"><div
align="right">Welcome <?php echo $_SESSION['fname']." ".
$_SESSION['lname']; ?></div></td>
<td width="15%" > <div align="center"><a href="logout.php">Log Out</a></div>
</td>
</tr>
</table>
</div>
</div>
<!--end of recent project-->
是否有任何腳本的你包括使用標題()? – rws907
可能的重複[警告:不能修改標題信息 - 標題已發送(PHP)](http://stackoverflow.com/questions/4173740/warning-cannot-modify-header-information-headers-already-sent-php) –