简体   繁体   English

session_start()错误

[英]session_start() Error

i have some Problems with session_start(); 我对session_start()有一些问题;

I know that nothing should be outputted before the session_start(); 我知道在session_start()之前不应输出任何内容; statement 声明

But i can't find the Problem in my Script 但我无法在我的剧本中找到问题

index.php: index.php文件:

<?php session_start();
include('functions.php');
if(!is_logged_in(session_id())){
    include('form.php');
}else{
?>
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
<?php
}
?>

But i always geh following Error: 但我总是跟着错误:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\\xampp\\htdocs\\fertige_scan\\index.php:1) in C:\\xampp\\htdocs\\fertige_scan\\index.php on line 1 警告:session_start()[function.session-start]:无法发送会话cookie - 已经在C:\\ xampp \\ htdocs \\ fertige_scan中发送的输出(输出从C:\\ xampp \\ htdocs \\ fertige_scan \\ index.php:1开始)第1行的\\ index.php

I hope you can help me :) 我希望你能帮帮我 :)

如果将文件保存为UTF8,请确保在没有BOM的情况下保存文件

确保您的文件保存为ANSI格式而不是UTF-8格式。

Assuming you have removed any extra characters after <? 假设你在<?后删除了任何多余的字符<? and before ?> , and that session_start(); 和之前的?> ,以及那个session_start(); is the first statement, you can try to change the file encoding to ANSI or UTF-8 without BOM, as suggested in session_start's PHP documentation . 是第一个语句,您可以尝试将文件编码更改为ANSI或UTF-8而不使用BOM,如session_start的PHP文档中所述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM