1

您好,我有一个登录系统,我在登录帐户时使用了会话。在

localhost 一切正常,但在 MY CPANEL 中显示以下内容

问题:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/scalepro/public_html/Admin Panel/Remote Employee/main.php:1) in /home/scalepro/public_html/Admin Panel/Remote Employee/main.php on line 3


Warning: Cannot modify header information - headers already sent by (output started at /home/scalepro/public_html/Admin Panel/Remote Employee/main.php:1) in /home/scalepro/public_html/Admin Panel/Remote Employee/main.php on line 20


<?php

session_start();
require_once('../../Admin Panel/db.php');
if(isset($_POST['email']) && !empty($_POST['email']) && isset($_POST['password']) && !empty($_POST['password']))
{
 $email = $_POST['email'];
 $password = $_POST['password'];
 $query="SELECT RemoteEmployeeFullName, RemoteEmployeeEmail, RemoteEmployeePassword FROM remoteemployees WHERE RemoteEmployeeEmail='".$email."' AND RemoteEmployeePassword='".$password."'";
 $queryrun=$connection->query($query);
 if($queryrun->num_rows > 0)
 {

     $_SESSION['email']=$RemoteEmployeeFullName;     
     header('Location:REPLists.php');
 }
 else
 {
     echo 'Email: <b>'.$email. '</b> or Password <b>'. $password.'</b> Is Not Typed Correctly Try Again Please!.';
     header( "refresh:5;url=../../spd/myaccount.php" );
 }

}
else
{
    header( "refresh:1;url=../../spd/myaccount.php" );
}

?>
4

2 回答 2

1

从开始打开和结束 php 标签中删除额外的 sapces,例如:-

<?php session_start();

还尝试在开始新会话之前检查会话是否已经开始。或标头已发送header_sent() 还通过缓冲源 ob_start() 来避免标头修改警告消息

于 2013-06-25T04:42:02.533 回答
0

检查您在第一个之前没有任何空格/换行符

于 2013-06-25T04:33:10.463 回答