2017-03-10 59 views
0

我有一个标题页,其中包含导航栏和必要的CSS,JS的。包含标题页会话错误

我想从联系页面调用标题页,但出现了问题。

我在联系页面上发生此错误。

  • 警告:在session_start():不能发送会话缓存限制器 - 已经发送了头(输出开始在C:\ XAMPP \ htdocs中\测试\包括\的header.php:84)在C:\ XAMPP \ htdocs中\ test \ contact.php on line 3

跟随联系页面代码。

<?php include_once ("includes/config.php"); 
include_once ("includes/header.php"); 
session_start(); 
require_once'includes/phpmailer/security.php'; 
?> 


<div class="container"> 
    <div class="contact"> 

     <?php if(isset($_GET['CaptchaPass'])){?> 
     <div >message sent</div> 
     <?php } ?> 
     <?php if(isset($_GET['CaptchaFail'])){?> 
     <div >message failed</div> 
     <?php } ?> 

     <form action="includes/contact-config.php" method="post"> 
      <div class="form-group"> 
       <label for="name">Your Name *</label> 
       <input type="text" name="name" autocomplete="off" required="" class="form-control" placeholder="Enter Name" <?php echo isset ($fields['name'])? 'value="'.e($fields['name']).'"':''?>> 
      </div> 
      <div class="form-group"> 
       <label for="email">Your Email address * </label> 
       <input type="email" name="email" autocomplete="off" required="" class="form-control" placeholder="Enter Email"<?php echo isset ($fields['email'])? 'value="'.e($fields['email']).'"':''?>> 
      </div> 
      <div class="form-group" > 
       <label for="message">Your Message *</label> 
       <textarea class="form-control" rows="8" id="comment" required="" name="message"<?php echo isset ($fields['message'])? e($fields['message']):''?>></textarea> 
       <br> 
       <div class="g-recaptcha" data-sitekey="6LcyfhgUAAAAAKunkwqqxFJSOPUzYbNmppLQbcWc"></div> 


       <input type="submit" value="Send" id="ContactButton" class="form-control" class="btn btn-primary"> 
      </div> 
     </form> 

    </div> 
</div> 
</body> 

<?php include ("includes/footer.php");?> 

的header.php文件夹路径 - > C:\ XAMPP \ htdocs中\测试\包括\的header.php

contact.php文件夹路径 - > C:\ XAMPP \ htdocs中\测试\ contact.php

+4

你的'config.php'或'header.php'正在发送一些输出。在包含 – bansi

+0

之前移动'session_start'感谢回复bahsi:') – Onur

回答

2

最有可能的问题是,includes/config.phpincludes/header.php正在向浏览器输出一些东西 - 可能是空白。

如果这些文件有关闭PHP标记?>,删除它们应该有助于解决问题。还要确保没有任何文件正在使用echoprint或其他输出功能。