Php登录框错误

时间:2015-05-23 17:29:55

标签: javascript php jquery html twitter-bootstrap

我有2个php文件,其中一个是主页的index.php,另一个是ustmenu.php,用于所有页面的顶部导航。 我在index.php中写require 'ustmenu.php';。 当我开始索引页面下拉列表不运行时,另一方面,如果我运行onlu'ustmenu.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>

1 个答案:

答案 0 :(得分:3)

如果在Web服务器上启动index.php时没有看到来自ustmenu.php的数据,这可能与从PHP manual获取的require有关:

  

require与include相同,除非失败,它还会产生致命的E_COMPILE_ERROR级别错误。换句话说,它将暂停脚本,而include仅发出警告(E_WARNING),允许脚本继续。

尝试:

include("ustmenu.php");

还要确保错误报告已启用,以便通过在index.php页面顶部添加以下内容来查看PHP返回的任何可能错误:

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

如果您收到任何错误,请告诉我