session_start() 一用就出现Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\AppServ\www\esw\admin\admin_login.php:1) in C:\AppServ\www\esw\admin\admin_login.php on line 2Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\AppServ\www\esw\admin\admin_login.php:1) in C:\AppServ\www\esw\admin\admin_login.php on line 2 这个错误
session_start() 要在所有输出之前
这个错误
session_start();
include("../include/user.php");
include("../config.inc.php");
if(isset($_POST['imageField'])){
$user=new user();
$name=trim($_POST['guestname']);
$psd=md5(trim($_POST['guestpass']));
$login=$user->login($name,$psd);
foreach($login as $value){
if($value["name"]!=""){
//$_SESSION['name']=$name;
setcookie("name",$name,time()+3600,'/');
echo $_COOKIE['name'];exit;
//$GLOBALS['name']=$name;
//$GLOBALS['SESSION']['psd']=$psd;
//$GLOBALS['SESSION']['gid']=$gid;
echo "<meta http-equiv=refresh content='0; url=index.php'>";
}else{
echo "<meta http-equiv=refresh content='0; url=index.php'>";
}
exit;
}
}
?>
另外你用什么编辑器写的,是不是保存了utf8格式,注意不能有bom
@ini_set('session.save_path',"/");这个我也设了,也没用
找到了 就是这个了服务器