Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent我是用notepad++编写的  编码是 utf-8 无 bom
代码在 session_start() 之前都没有输出 网上找了好多方法都不行  有人知道吗 

解决方案 »

  1.   

    以 ob_start() 開啟緩衝區將輸出資訊寫入緩衝區,可避免 headers 先於 session_start() 輸出,寫入緩衝區的內容可由 flush() 或 ob_end_flush() 輸出至瀏覽器,以下範例不會顯示錯誤訊息:
    <?php
    ob_start();
    session_start();
    ob_end_flush();
    ?>
      

  2.   

    你是不是用类似include 包含了其他页面??确定其他页面没有提前输出??
    检查下空格!!
      

  3.   

    Cannot send session cache limiter - headers already sent
    这句话的意思很明白了,在发出session的时候,头部已经发出了
      

  4.   

    代码如下
    if(isset($_POST['submitted'])){// has been submit
        //connect database
    require_once('connect.php');
    //instart error
    $errors=array();
    //check email
    if(empty($_POST['email'])){
     $errors[]='email is not null';
    }else{
     $e=$_POST['email'];
    }
    //check password
    if(empty($_POST['password'])){
     $errors[]='password is not null';
    }else{
     $p=$_POST['password'];
    }
       if(empty($errors)){ //if everything is ok
        
     $sql = "SELECT user_id, first_name FROM users WHERE email='$e' AND password=SHA('$p')";
     $query=mysql_query($sql);
     $row=mysql_fetch_array($query);
     if($row){ //if a recode 
        //SESSION START

    session_start();
    $_SESSION['user_id']=$row[0];
    $_SESSION['first_name']=$row[1];
    //url
    $url='http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
        if((substr($url,-1)=='/') or (substr($url,-1)=='\\')){
           $url=substr($url,0,-1); 
        }
         $url.='/logining.php';
     //header("Location:$url");
     header("Location: $url");
     exit();
     }else{  //not recode
        echo "<h2>system error</h2>
    <p>meiyou ni yao chaxun de jilu</p> ";


     }// end if($row)
       }//end if empty errors
      }else{ //if not set submit
        $errors=NULL;
      }//end submitted if
      if(!empty($errors)){
        echo '<h1>PAGE ERROR</h1>';
    foreach ($errors as $msg){
     echo "-$msg".'<br/>';
    }
    exit();

      }
      $page_title = 'Login';
    include ('./includes/header.html');
      //show form 
    ?>
    <h2>LOGIN  tt</h2>
    <form action="login.php" method="post">
      <p>email:
        <input type="text" name="email"  />
      </p>
      <p>password:
        <input type="password" name="password"  />
      </p>
      <p>
        <input type="submit" value="Submit" />
      </p>
      <input type="hidden" name="submitted" value="TRUE" />
    </form><?php 
     include('includes/footer.html');
    ?>
      

  5.   

    把 session_start();  放在文件最开头试试吧,,有错误警告提示,或者空格很难看出来的