【发布时间】:2017-08-01 05:57:54
【问题描述】:
我有一个标题页,其中包括导航栏和必要的 css、js。
我正在尝试从联系页面调用标题页面,但出现了问题。
我在联系页面上看到了这个错误。
- 警告:session_start():无法发送会话缓存限制器 - 标头已在 C:\xampp\htdocs\test\contact 中发送(输出开始于 C:\xampp\htdocs\test\includes\header.php:84) .php 在第 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\test\includes\header.php
contact.php 文件夹路径 --> C:\xampp\htdocs\test\contact.php
【问题讨论】:
-
您的
config.php或header.php正在发送一些输出。在包含之前移动session_start -
感谢您的回复 bahsi :')