doufuxi7093 2017-03-10 19:10
浏览 18
已采纳

包括标题页会话错误

I have a header page which includes navbar and necessary css's, js's.

I'm trying call the header page from contact page but there was something going wrong.

I take this error on the contact page.

  • Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\test\includes\header.php:84) in C:\xampp\htdocs\test\contact.php on line 3

following the contact page codes.

<?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 folder path--> C:\xampp\htdocs\test\includes\header.php

contact.php folder path --> C:\xampp\htdocs\test\contact.php

  • 写回答

1条回答 默认 最新

  • dongluan0020 2017-03-10 19:20
    关注

    Most likely issue is that the includes/config.php or includes/header.php is outputting something to the browser - probably white space.

    If these files have a closing PHP tag ?>, removing them should help solve the issue. Also make sure none of the files are using echo or print or other output functions.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 echarts动画效果失效的问题。官网下载的例子。
  • ¥60 许可证msc licensing软件报错显示已有相同版本软件,但是下一步显示无法读取日志目录。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加