您好我有一个登录系统,我在登录帐户时使用了会话。在
localhost每个都一切正常,但在我的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" );
}
?>
答案 0 :(得分:1)
从开始开始删除额外的sapces并结束php标记,如: -
<?php session_start();
还尝试在启动新会话之前检查会话是否已启动。或标头已发送header_sent() 还可以通过缓冲源来避免标头修改警告消息 ob_start()
答案 1 :(得分:0)
检查第一个之前没有任何空格/换行符