PHP session_start无法调用withput生成警告警告:session_start():无法发送会话缓存限制器 - 已发送的标头

时间:2014-01-12 15:27:26

标签: php session-variables

我收到了以下警告:

  

警告:session_start():无法发送会话缓存限制器 - 标头   已发送(输出开始于   /customers/a/4/5/dalakh.se/httpd.www/RabbitResultHandler/competitions.php:1)   在   /customers/a/4/5/dalakh.se/httpd.www/RabbitResultHandler/competitions.php   在第1行

我有一点谷歌搜索,据我所知,session_start()应该在页面顶部但我仍然遇到这个问题,并认为我已经尝试了session_start()的可能的位置,但没有运气。任何有问题的人都会有什么问题?

我附上以下代码:

<?php session_start(); ?>
<!DOCTYPE HTML>
<html>
    <head>
        <meta charset = "UTF-8" />
        <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" type="text/css" href="style.css">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    </head>
<body>
<?php
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
            echo 'I AM FREE!!!!!';
}

    require 'Functions/common_functions.php';
    printHeadWithLoginButton($_GET["club"]);
?>
<div style="float:right">
<h1>Tävlingar</h1>
<?php

$directory = "/customers/a/4/5/dalakh.se//httpd.www/RabbitResultHandler/Competitions/";

$images = glob($directory . "*.xml");
 echo "<table>";

foreach($images as $image)
{
    //echo $image . "<br />";
    //echo basename($image, ".xml") . "<br />";

    //echo "<a href=\"registration.php?competition=" . basename($image) . "\">" . basename($image, ".xml") . "</a> - ";
    echo "<tr>";
    echo "<td>";
    echo basename($image, ".xml");
    echo "</td>";
    echo '<td style="margin-left:auto;margin-right:auto;text-align: center;">';
    echo "<input type=\"button\" value=\"" . "Anmäl" . "\" onclick=\"location.href='registration.php?competition=" . basename($image, ".xml") . "';\">";
    echo "</td>";
    echo '<td style="margin-left:auto;margin-right:auto;text-align: center;">';
    echo "<input type=\"button\" value=\"" . "Översikt" . "\" onclick=\"location.href='overview.php?competition=" . basename($image, ".xml") . "';\">";
    echo "</td>";
    //echo "<br />";
    echo "</tr>";

}
echo "</table>";

echo "<input type=\"button\" value=\"" . "Arkiv över gamla tävlingar" . "\" onclick=\"location.href='competitions_archive.php';\">";

?>
<p>Har du problem eller undrar du hur man använder vårt anmälningsformulär? Kolla i första hand vår FAQ och skulle inte den vara tillräcklig eller om du bara vill delge dina synpunkter nås vi via vårt kontakformulär.</p>  
<?php
echo "<input type=\"button\" value=\"" . "FAQ" . "\" onclick=\"location.href='faq.php';\">";
?>
<input type="button" value="Kontakta oss" onclick="location.href='contact.php'" />
</div>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

您的文件编码为UTF-8,因此在开头就有Byte-Order Mark权限。

尝试将文件的编码更改为单字节字符集,或“无BOM的UTF-8”(某些编辑器中的选项,如Notepad ++)