标题已经由[重复]发送

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了标题已经由[重复]发送相关的知识,希望对你有一定的参考价值。

这个问题在这里已有答案:

我在这里有一点错误。我正在尝试发送标题时收到此消息:

警告:无法修改标头信息 - 已在第34行的E: xampp htdocs kursova1 pages login.php中发送的标头(输出从E: xampp htdocs kursova1 layout content.php:1开始)

在content.php中,这是我的代码如下:

<div id="body-wrap" data-background="url(css/images/rubber_grip.png) repeat" class="cactus-box  video-v2-setbackground  ">
<div id="wrap">
    <header id="header-navigation">
    <!--Navigation style-->
        <div class="cactus-nav-control  cactus-nav-style-3">
            <div class="cactus-nav-main dark-div  dark-bg-color-1" >
                <div class="cactus-container padding-30px ">
                    <div class="cactus-row magin-30px">                 
                        <!--nav left-->
                        <div class="cactus-nav-left">
                            <!--logo-->
                            <div class="cactus-logo navigation-font">
                                <a href="http://videopro.cactusthemes.com/v2/">
                                    <img src="http://cdn.cactusthemes.com/wp-content/uploads/2016/05/01-videopro-logo-dark-1x.png" alt="VideoPro" title="VideoPro" class="cactus-img-logo">
                                    <img src="http://cdn.cactusthemes.com/wp-content/uploads/2016/05/01-videopro-logo-dark-1x.png" alt="VideoPro" title="VideoPro" class="cactus-img-logo cactus-img-sticky">
                                </a>
                            </div><!--logo-->                               
                            <!--header search-->
                            <div class="cactus-header-search-form search-box-expandable">
                                <aside id="advance_search_form-2" class="widget widget-asf">
                                    <style>#advance_search_form-2 .ct-sub-w-title{color:FFFFFF !important; background:FF0000 !important}</style>
                                    <div class="widget-inner">
                                        <div class="cactus-main-menu cactus-open-search-mobile navigation-font">
                                            <ul>
                                                <li><a href=""><i class="fa fa-search"></i></a></li>
                                            </ul>
                                        </div>
                                        <form role="search" method="get" id="searchform">
                                            <div>

                                                <span class="searchtext">
                                                    <input id="search1" onchange="" type="text" value="" name="s" class="ss"  autocomplete="off" placeholder="Enter Keyword"/>
                                                    <span class="suggestion"><!-- --></span>
                                                    <i class="fa fa-search" aria-hidden="true"></i>
                                                </span>

                                                <input type="hidden" name="video_only" value="1" />
                                            </div>
                                        </form>
                                    </div>
                                </aside>                    
                            </div><!--header search-->
                        </div> <!--nav left-->

                        <!--nav right-->
                        <div class="cactus-nav-right">
                            <div class="cactus-main-menu cactus-open-menu-mobile navigation-font">
                                <ul>
                                    <li><a href="javascript:;"><i class="fa fa-bars"></i>MENU</a></li>
                                </ul>
                            </div>

                            <div class="cactus-main-menu cactus-user-login navigation-font">
                                <ul>                                     
                                    <li>   
                                        <a href="index.php?p=login"><i class="fa fa-user"></i>&nbsp;Вход</a>
                                    </li>                                       
                                </ul>
                            </div>

                        </div><!--nav right-->
                    </div>
                </div>
            </div>
        </div>


        <div class="cactus-nav-control  cactus-nav-style-3">  <!--add Class: cactus-nav-style-3-->
            <div class="cactus-nav-main dark-div dark-bg-color-1">

                <div class="cactus-container padding-30px ">

                    <!--Menu Down-->
                    <div  class="cactus-row magin-30px">
                        <!--nav left-->
                        <div class="cactus-nav-left cactus-only-main-menu">
                            <!--main menu / megamenu / Basic dropdown-->                                  
                            <div class="cactus-main-menu navigation-font">
                                <ul class="nav navbar-nav">
                                    <!-- <li id="mega-menu-item-1589" class=" menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children parent level0 has-sub dropdown main-menu-item list-style"><a href="index.php?p=home"><i class="fa fa-home"></i> Начало</a>
                                    </li>
                                    <li id="mega-menu-item-773" class=" menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children parent level0 has-sub dropdown main-menu-item list-style"><a href="#"><i class="fa fa-bars"></i> Features</a>
                                    <li id="mega-menu-item-3236" class=" menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children parent level0 has-sub dropdown main-menu-item list-style"><a href="index.php?p=forum"><i class="fa fa-users"></i> Форум</a>
                                    </li>
                                    <li id="mega-menu-item-3279" class=" menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children parent level0 has-sub dropdown main-menu-item list-style"><a href="#"><i class="fa fa-search-plus"></i> Browse</a>
                                    </li>
                                    <li id="mega-menu-item-3456" class=" menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children parent level0 has-sub dropdown main-menu-item list-style"><a href="#"><i class="fa fa-dollar"></i> Premium Content</a>
                                    </li> -->

                                    <?php
                                    $pages = array(
                                        "home" => "Начало",   
                                        "categories" => "Категории", 
                                        "forum" => "Форум",
                                        "upload" => "Качи видео",
                                        "contact" => "Контакти",
                                    );

                                    $p = (isset($_GET['p'])) ? $_GET['p'] : "";

                                    foreach ($pages as $url => $label) {
                                      echo '<li id="mega-menu-item-1589" class=" menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children parent level0 has-sub dropdown main-menu-item list-style ';

                                      if ($p == $url) {  
                                            echo 'current-menu-ancestor current-menu-parent';                              
                                       }                                                 
                                      echo '"><a href="index.php?p=' . $url . '"><i class="fa fa-home"></i>' . $label . '</a></li>';
                                    }
                                    ?>

                                    <li id="mega-menu-item-3189" class=" menu-item menu-item-type-post_type menu-item-object-page level0 main-menu-item list-style"><a href="index.php?p=register"><i class="fa fa-arrow-circle-o-right"></i> Регистрация</a>
                                    </li>                       
                                </ul>
                            </div><!--main menu-->
                        </div><!--nav left-->  
                    </div>
                    <!--Menu Down-->                
                </div>
            </div>
        </div>
    <!--Navigation style-->
    </header>

    <header id="header-navigation" class="sticky-menu">
    <!--Navigation style-->
        <div class="cactus-nav-control">
            <div class="cactus-nav-main dark-div  dark-bg-color-1">
                <div class="cactus-container padding-30px">
                    <div class="cactus-row magin-30px reset-default-nav">

                        <!--nav left-->
                        <div class="cactus-nav-left">
                            <!--logo-->
                            <div class="cactus-logo navigation-font">
                                <a href="http://videopro.cactusthemes.com/v2/">
                                    <img src="http://cdn.cactusthemes.com/wp-content/uploads/2016/05/01-videopro-logo-dark-1x.png" alt="VideoPro" title="VideoPro" class="cactus-img-logo">
                                    <img src="http://cdn.cactusthemes.com/wp-content/uploads/2016/05/01-videopro-logo-dark-1x.png" alt="VideoPro" title="VideoPro" class="cactus-img-logo cactus-img-sticky">
                                </a>
                            </div><!--logo-->


                            <!--header search-->
                            <div class="cactus-header-search-form search-box-expandable">
                                <aside id="advance_search_form-2" class="   widget widget-asf">
                                    <style>#advance_search_form-2 .ct-sub-w-title{color:FFFFFF !important; background:FF0000 !important}</style>
                                    <div class="widget-inner">
                                        <div class="cactus-main-menu cactus-open-search-mobile navigation-font">
                                            <ul>
                                                <li><a href="javascript:;"><i class="fa fa-search"></i></a></li>
                                            </ul>
                                        </div>
                                        <form role="search" onsubmit="if(jQuery('.ss',jQuery(this)).val() == '' || jQuery('.ss',jQuery(this)).val() == '') return false;" method="get" id="searchform" action="http://videopro.cactusthemes.com/v2/">
                                            <div>
                                                <span class="searchtext">
                                                    <input id="search2" onchange="updateSearch(this, jQuery('#search1'))" type="text" value="" onfocus="if(this.value == '') this.value = '';" onblur="if(this.value == '') this.value=''" name="s" class="ss" autocomplete="off" placeholder="Enter Keyword">
                                                    <span class="suggestion" style="max-height: 145px;"><!-- --></span>
                                                        <i class="fa fa-search" aria-hidden="true"></i>
                                                </span>

                                                    <input type="hidden" name="video_only" value="1">
                                            </div>
                                        </form>
                                    </div>
                                </aside>                    
                            </div>

                            <div class="cactus-main-menu cactus-open-menu-mobile navigation-font">
                                <ul>
                                    <li>
                                        <a href="javascript:;"><i class="fa fa-bars"></i></a>
                                    </li>
                                </ul>
                            </div><!--header search-->
                        </div> <!--nav left-->

                        <!--nav right-->
                        <div class="cactus-nav-right">
                            <div class="cactus-main-menu cactus-open-menu-mobile navigation-font">
                                <ul>
                                  <li><a href="javascript:;"><i class="fa fa-bars"></i>MENU</a></li>
                                </ul>
                            </div>
                             <div class="cactus-main-menu cactus-user-login navigation-font">
                                <ul>                                     
                                    <li>   
                                        <a href="http://videopro.cactusthemes.com/v2/account-2/?redirect_to=http%3A%2F%2Fvideopro.cactusthemes.com%2Fv2"><i class="fa fa-user"></i>&nbsp;Вход</a>
                                    </li>                                       
                                </ul>
                            </div>
                        </div><!--nav right-->

                        <div class="cactus-nav-left cactus-only-main-menu">
                            <!--main menu / megamenu / Basic dropdown-->                                  
                            <div class="cactus-main-menu navigation-font">
                                <ul class="nav navbar-nav">
                                    <!-- <li id="mega-menu-item-1589" class=" menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children parent level0 has-sub dropdown main-menu-item list-style"><a href="index.php?p=home" class="cactus-hasIcon"><i class="fa fa-home"></i> Начало</a>
                                    </li>

                                    <li id="mega-menu-item-773" class=" menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children parent level0 has-sub dropdown main-menu-item list-style"><a href="#" class="cactus-hasIcon"><i class="fa fa-bars"></i> Features</a>
                                    </li>

                                    <li id="mega-menu-item-3236" class=" menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children parent level0 has-sub dropdown main-menu-item list-style"><a href="index.php?p=forum" class="cactus-hasIcon"><i class="fa fa-users"></i> Форум</a>
                                    </li>

                                    <li id="mega-menu-item-3279" class=" menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children parent level0 has-sub dropdown main-menu-item list-style"><a href="#" class="cactus-hasIcon"><i class="fa fa-search-plus"></i> Browse</a>
                                    </li>

                                    <li id="mega-menu-item-3456" class=" menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children parent level0 has-sub dropdown main-menu-item list-style"><a href="#" class="cactus-hasIcon"><i class="fa fa-dollar"></i> Premium Content</a>
                                    </li> -->

                                    <?php
                                    $pages = array(
                                        "home" => "Начало",   
                                        "categories" => "Категории", 
                                        "forum" => "Форум",
                                        "upload" => "Качи видео",
                                        "contact" => "Контакти",
                                    );

                                    $p = (isset($_GET['p'])) ? $_GET['p'] : "";

                                    foreach ($pages as $url => $label) {
                                      echo '<li id="mega-menu-item-1589" class=" menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children parent level0 has-sub dropdown main-menu-item list-style ';

                                      if ($p == $url) {  
                                            echo 'current-menu-ancestor current-menu-parent';                              
                                       }                                                 
                                      echo '"><a class="cactus-hasIcon" href="index.php?p=' . $url . '"><i class="fa fa-home"></i>' . $label . '</a></li>';
                                    }
                                    ?>
                                    <li id="mega-menu-item-3189" class=" menu-item menu-item-type-post_type menu-item-object-page level0 main-menu-item list-style"><a href="index.php?p=register"><i class="fa fa-arrow-circle-o-right"></i> Регистрация</a>
                                    </li>                       
                                </ul>
                            </div><!--main menu-->
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </header>

    <div id="cactus-body-container">

        <?php
            $pages_dir = 'pages';

            if (!empty($_GET['p'])) {
                $pages = scandir($pages_dir, 0);
                unset($pages[0], $pages[1]);
                $p = $_GET['p'];

                if (in_array($p.'.php', $pages)) {
                    include($pages_dir.'/'.$p.'.php');
                } else {
                    echo 'Sorry, page not found.';
                }
            } else {
              include($pages_dir.'/home.php');
            }
        ?>

    </div><!-- container -->

如你所见,我没有任何空格,我也没有看到任何错误。

这是我的登录页面,我正在尝试发送它:

<div class="cactus-sidebar-control   ">    
<div class="cactus-container ">                         
    <div class="cactus-row">                                                
        <div class="main-content-col">
            <div class="main-content-col-body">
                <div class="single-page-content">
                    <article class="cactus-single-content">                                 

                        <div class="single-page-content single-content">
                            <article id="post-3165" class="post-3165 page type-page status-publish hentry cactus-single-content">
                                <div class="body-content">
                                    <!--Content-->
                                    <div class="ms-account-wrapper videopro-cusom-cl">
                                        <div class="ms-membership-form-wrapper">        
                                            <div class="ms-login-form">

                                                <?php 
                                                    $error = '';
                                                    if (isset($_POST['login'])) {
                                                        $username = $_POST['username'];
                                                        $password = $_POST['password'];
                                                        if (empty($username) or empty($password))
                                                        {
                                                            $error = 'Въведените данни не отговарят на изискванията!';
                                                        } else {
                                                            $query = mysqli_query($conn, "SELECT * FROM users WHERE username='$username' AND password='".md5($password)."'");

                                                            $rows = mysqli_num_rows($query);
                                                            if ($rows == 1) {
                                                                $row = mysqli_fetch_assoc($query);
                                                                $_SESSION['uid'] = $row['UserID'];
                                                                $_SESSION['username'] = $row['username'];

                                                                header('Location: ./index.php?p=welcome');
                                                            } else {
                                                                $error = "Въведените данни са грешни!";
                                                            }
                                                        }
                                                    }
                                                ?>
                                                <p><?php echo $error; ?></p>

                                                <form name="loginform" id="loginform" action="" method="post" class="ms-form ms-form-login ms-no-labels autofocus" style=""> 

                                                    <div class="form"> 
                                                        <label>Потребителско име:</label>
                                                        <input type="text" name="username" id="user_login" class="input focus" value="" size="10" placeholder="Username"> 

                                                        <label>Парола:</label>
                                                            <input type="password" name="password" id="user_pass" class="input" value="" size="20" placeholder="Password"> 

                                                        <div class="nav"> 
                                                            <p>
                                                                <a class="lost" href="#lostpassword"> 
                                                                    Забравена парола?                       
                                                                </a>
                                                            </p> 
                                                        </div> 
                                                        <p class="login-remember ms-field"> 
                                                            <input name="rememberme" type="checkbox" id="rememberme" value="forever" /> 
                                                            <label for="rememberme"> Запомни ме</label> 
                                                        </p>

                                                        <p class="login-submit"> 
                                                            <input type="submit" name="login" id="wp-submit" class="button-primary" value="Вход" /> 
                                                        </p> 
                                                    </div> 
                                                </form>

                                            </div>
                                            <a href="index.php?p=register">Регистрация?</a>
                                        </div>
                                    </div>
                                    <div class="ms-account-wrapper"> </div>
                                    <hr />
                                </div>
                            </article>
                        </div>                                                    
                    </article>
                </div>
            </div>
        </div>                          
    </div>
</div>       

如果有人知道我的错误在哪里,我会很高兴听到它。顺便说一句,如果我把我的登录页面中的PHP代码放在content.php的开头,它工作正常,但我不认为它必须在那里。谢谢!

答案

将此代码放在具有标题的非常php页面的顶部

<?php
ob_start();
// your code here

?>

以上是关于标题已经由[重复]发送的主要内容,如果未能解决你的问题,请参考以下文章

将数据从活动发送到片段android工作室[重复]

标题已经由[重复]发送

iphone / Objective c的最佳代码片段网站是啥[重复]

是否可以将一个对象从一个片段发送到另一个片段?

将数据从一个片段发送到另一个片段时出错。 (两个片段都由一个活动托管)

需要解释从适配器发送数据到片段