簡體   English   中英

包含標題頁會話錯誤

[英]include header page session error

我有一個標題頁,其中包含導航欄和必要的CSS,JS。

我正在嘗試從聯系頁面調用標題頁面,但是出了點問題。

我在聯系頁面上看到此錯誤。

  • 警告:session_start():無法發送會話緩存限制器-已發送的標頭(輸出從C:\\ xampp \\ htdocs \\ test \\ includes \\ header.php:84開始)在C:\\ xampp \\ htdocs \\ test \\ contact.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

最可能的問題是includes/config.phpincludes/header.php正在向瀏覽器輸出某些內容-可能是空白。

如果這些文件帶有關閉的PHP標記?> ,則刪除它們應該有助於解決問題。 還要確保沒有文件使用echoprint或其他輸出功能。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM