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.

    评论

报告相同问题?

悬赏问题

  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题