-2

i have header.php that include nav bar with using the session to transfer stored data but the problem is that the browser keep display the error message:

A session had already been started - ignoring session_start() in C:\wamp\www\new adamKhoury\header.php on line 2

header.php

<?php
session_start();
ob_start();
/*if($_SESSION['login'] != 'true'){
        header("location:index.php");
    }*/
    //var_dump($login_user);
 require_once('include/connect.php'); 

   $id = ($_SESSION['user_id']);
   $username= ($_SESSION['user_name']) ;
   var_dump($username);
   var_dump($id);



?>
<!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>Untitled Document</title>
<link href='http://fonts.googleapis.com/css?family=Oswald:400,300' rel='stylesheet' type='text/css' />
<link href='http://fonts.googleapis.com/css?family=Abel|Satisfy' rel='stylesheet' type='text/css' />
<link href="default.css" rel="stylesheet" type="text/css" media="all" />

</head>

<body>
<div id="banner">
  <div class="img-border">
    <div id="header-wrapper">
      <div id="header">

        <div id="logo">
          <marquee width="80%">
            <h1><b>Social Media Network</b></h1>
          </marquee>
        </div>
         <div id="menu">
             <ul>
                <li><a href="profile.php" accesskey="1" title=""><?php echo $username ?>'s Profile</a></li>
                <li><a href="update_account.php" accesskey="2" title="">Update</a></li>
                <li><a href="search.php" accesskey="3" title="">Search</a></li>
                <li><a href="map.php" accesskey="4" title="">Map</a></li>
                <li><a href="feedback_form.php" accesskey="4" title="">Feedback</a></li>
                <li><a href="help.php" accesskey="6" title="">Help</a></li>
                <li><a href="logout.php" accesskey="7" title="">Logout</a></li>
            </ul>
         </div>


      </div>
    </div>
    <img src="images/web_header copy.jpg" width="1121" height="210" alt="" />
  </div>
</div>

</body>
</html>
<?php ob_end_flush(); ?>
4

1 回答 1

1

错误信息很清楚:你打session_start() 了两次电话
,因此必须删除一个电话

于 2013-05-08T13:23:44.893 回答