dqdjfb2325 2014-04-20 22:16
浏览 95

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

I read the answers here How to fix "Headers already sent" error in PHP but this not fix my error.

i don't understand, session_start() is the first thing i call in my files and I am using the UTF-8 without BOM encoding. But i still get this php warning.

Error :

PHP Warning:  session_start(): Cannot send session cache limiter - headers already sent (output started at /home/feyzprod/public_html/nearby/register.php:1) in /home/feyzprod/public_html/nearby/register.php on line 1

My file encoding is

Encoding is UTF-8 without BOM

Code :

<?php session_start();
    require_once('bdservice.php');
    require_once('script.php');

    $bd = new BDService();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">

<title>NearBy Me : Courtier immobiliers</title>

<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/ico.css" />
<link rel="stylesheet" href="https://formoid.net/forms/30/17477/formoid-default-skyblue.css" type="text/css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://formoid.net/lib/iframe.js"></script>
<link rel="stylesheet" href="https://formoid.net/lib/form.css" type="text/css" />

<script>

</script>

</head>

<body>
    <div class='bar'>
        <div class='header'>
            <div id='left'></div>

            <div id='right'>
                <div style='margin-top:35px;'>
                <span><a href='#'>Français</a> | <a href='#'>Anglais</a></span><br/><br/>
                <?php
                    if(isset($_SESSION['authentification']))
                    {
                        echo "<a href='profil.php'><button class=\"large green button\">Profil</button></a>";
                    }
                    else
                    {
                        echo "<a href='connexion.php'><button class=\"large green button\">Login</button></a>";
                    }
                ?>
                </div>
            </div>

            <div style='clear:both;'></div>
        </div>
    </div>

    <div class='inscription'>
        <img src='images/inscription.png' alt='inscription' title='inscription' /><br/><br/>
            <?php
                if(!isset($_POST['Valider']))
                {
  • 写回答

1条回答 默认 最新

  • douwa1304 2014-04-20 22:17
    关注

    You probably have a space or other whitespace character at the beginning of /home/feyzprod/public_html/nearby/register.php, indicated in your error that it is on line 1.

    The space will echo to the output which means that you can no longer write to the headers, which is where PHP wants to set the session information via a cookie.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog