2015-05-23 288 views
0

我有2個PHP文件其中之一是index.php的主頁其他一個是ustmenu.php所有頁面的頂級導航。 我在index.php中寫了require 'ustmenu.php';。 當我開始索引頁下拉列表不運行,另一方面,如果我運行onlu'ustmenu.php'它運行。我怎麼解決這個問題?Php登錄框錯誤

我ustmenu.php:

<div class="container main-nav"> 
    <div class="row margin-bottom-zero"> 
     <div class="col-xs-12"> 
      <nav class="navbar"> 
       <ul class="nav navbar-nav"> 
        <li class="active"><a href="index.php"><i class="glyphicon glyphicon-home"></i> Anasayfa</a></li> 
        <li><a href="nedenyardimetmeliyim.html">Neden yardım etmeliyim</a></li> 
        <li><a href="bagis.php">Bağış Yap</a></li> 
        <li><a href="ihtiyacsahipleri.html">İhtiyaç sahipleri</a></li> 
        <li><a href="hakkimizda.html">Hakkımızda</a></li> 
        <li><a href="hakkimizda.html#tab3">İletişim</a></li> 
        <?php 
        require 'loggedin.php'; 
        if(login()){ 
         echo ' <li><a href="logout.php">Çıkış</a></li>'; 
        }?> 
       </ul> 
       <div class="modal fade" id="login-modal-box" role="dialog" aria-labelledby="gridSystemModalLabel" aria-hidden="true"> 
        <form action="girisyap.php" method="POST"> 


         <div class="modal-dialog user-login-box-dialog"> 
          <div class="modal-content"> 
           <div class="modal-header"> 
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> 
            <h4 class="modal-title" id="gridSystemModalLabel">Kullanıcı Giriş Paneli</h4> 
           </div> 

           <div class="modal-body"> 
            <div class="container-fluid"> 
             <div class="row"> 

              <div class="form-group"> 
               <label for="exampleInputEmail1">Eposta Adresiniz</label> 
               <input type="email" class="form-control" name="exampleInputEmail" id="exampleInputEmail1" placeholder="Enter email"> 
              </div> 
              <div class="form-group"> 
               <label for="exampleInputPassword1">Şifre</label> 
               <input type="password" class="form-control" name ="exampleInputPassword" id="exampleInputPassword1" placeholder="Password"> 
              </div> 

              <div class="checkbox"> 
               <label> 
                <input type="checkbox"> Beni hatırla 
               </label> 
              </div> 

             </div> 
            </div> 
           </div> 
           <div class="modal-footer"> 
            <input type="submit" class="btn btn-primary"> Giriş Yap</input> 
           </div> 
          </div><!-- /.modal-content --> 
         </div><!-- /.modal-dialog --> 

        </form> 
       </div><!-- /.modal --> 


       <ul class="nav navbar-nav navbar-right user-login-nav"> 
        <li class="dropdown"> 
         <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> 
          <i class="glyphicon glyphicon-user"></i> 
          <span class="caret"></span> 
         </a> 
         <ul class="dropdown-menu" role="menu"> 
          <li><a href="/giris-yap" data-toggle="modal" data-target="#login-modal-box" class="list-group-item">Giriş</a></li> 
          <li><a href="yenikayit.html">Kayıt Ol</a></li> 
         </ul> 
        </li> 
       </ul> 
</nav> 
     </div> 
    </div> 

我的index.php:

<!DOCTYPE html> 
<html lang="tr"> 
<head> 
    <meta charset="UTF-8"> 
    <title>Bağış Sitesi</title> 

    <!-- Latest compiled and minified CSS --> 
    <link rel="stylesheet" href="public/css/bootstrap.min.css"> 

    <link rel="stylesheet" href="public/css/main.css"> 

    <!-- Owl Carousel --> 
    <link rel="stylesheet" href="public/css/owl.carousel.css"> 
    <link rel="stylesheet" href="public/css/owl.theme.css"> 


</head> 
<body> 

    <?php 
    require 'ustmenu.php'; 
    ?> 

    <div class="container margin-bottom"> 

     . 
. 
. 
. 
. 
</div> 

<!-- Include Jquery --> 
    <script src="public/js/jquery-1.11.1.js"></script> 

<!-- Latest compiled and minified JavaScript --> 
    <script src="public/js/bootstrap.min.js"></script> 
    <script src="public/js/owl.carousel.min.js"></script> 
    <script src="public/js/script.js"></script> 

</body> 
</html> 
+0

你會得到任何錯誤? –

+0

在編輯器中出現'

」method =「POST」>' – undone

+0

中的拼寫錯誤。但在主頁(index.php)下拉菜單不runnig –

回答

3

如果Web服務器上,這可能發動的index.php當您沒有看到來自ustmenu.php數據與require做從PHP manual採取:

要求是相同的,除了包括在故障時它瓦特生病也會產生致命的E_COMPILE_ERROR級錯誤。換句話說,它會停止腳本,而包含只發出警告(E_WARNING),允許腳本繼續。

嘗試:

include("ustmenu.php"); 

同時確保錯誤報告是這樣,你可以看到任何可能出現的錯誤PHP是通過添加以下爲您index.php頁面頂部返回:

ini_set('display_errors',1); 
ini_set('display_startup_errors',1); 
error_reporting(-1); 

讓我知道如果你有任何錯誤