【问题标题】:header displaying a notice in php mysql [closed]在php mysql中显示通知的标题[关闭]
【发布时间】:2013-05-08 13:20:01
【问题描述】:

我有包含导航栏的 header.php,使用会话传输存储的数据,但问题是浏览器一直显示错误消息:

会话已开始 - 忽略第 2 行 C:\wamp\www\new adamKhoury\header.php 中的 session_start()

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(); ?>

【问题讨论】:

标签: php mysql session header


【解决方案1】:

错误信息很清楚:您正在调用session_start() 两次
因此必须删除一个电话

【讨论】:

  • 是的,我在配置文件 .php 中调用 session_start 但这样做是不对的???
  • 我确实通过使用 if 语句修复了错误 if(!isset($_SESSION)) { session_start(); }
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-09
  • 1970-01-01
  • 2014-08-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多