PDO php路由不显示页面

时间:2017-08-10 09:10:44

标签: php pdo routing routes

我有一个运行php路由的索引页面,但它没有显示任何页面,它只显示白色空白页面。这是索引页面的代码

 <?php

ini_set('memory_limit', '-1');

include 'include/connect.php';

     /*
    The following function will strip the script name from URL i.e.  http://www.something.com/search/book/fitzgerald will become /search/book/fitzgerald
    */
    function getCurrentUri()
    {
        $basepath = implode('/', array_slice(explode('/', $_SERVER['SCRIPT_NAME']), 0, -1)) . '/';
        $uri = substr($_SERVER['REQUEST_URI'], strlen($basepath));
        if (strstr($uri, '?')) $uri = substr($uri, 0, strpos($uri, '?'));
        $uri = '/' . trim($uri, '/');
        return $uri;
    }

    $base_url = getCurrentUri();

    $routes = array();
    $routes = explode('/', $base_url);
   /* foreach($routes as $route)
    {
        if(trim($route) != '')
            array_push($routes, $route);
        echo $routes;
    }*/

    /*
    Now, $routes will contain all the routes. $routes[0] will correspond to first route. For e.g. in above example $routes[0] is search, $routes[1] is book and $routes[2] is fitzgerald
    */

    if($routes[1] != ''){

        $pages = array("dashboard", "login", "News", "list-news", "add-users", "list-users","user profile", "category", "signup", "logout", "profile", "change-password", "password", "forgot-password");

            if(in_array($routes[1], $pages)){

                    $page = $routes[1];


            }
            else
            {


            $page = "dashboard";

            }


    }

    else
    {

        $page = "dashboard";

    }

    if ($page == 'login' || $page == 'signup' || $page == 'forgot-password' || $page == 'change-password') {

        if (isset($_SESSION['logged_user'])) {
            //header("location: login");
            require 'include/account_header.php';
            require 'include/topmenu.php';
            require 'include/leftmenu.php';
            require 'pages/'.$page.'.php';

        }



    }
    else
    {

        if (!isset($_SESSION['logged_user'])) {
           // header("location: login");
        }else{


            $name = $_SESSION['xy'];
            $user_id = $_SESSION['xz'];
            $email = $_SESSION['logged_user'];

                $wx=$conn->prepare("SELECT * FROM sysconfig");
                $wx->execute();
                 while($wx->fetch())

                    $_SESSION['dbv'] = $row['varable_name'];
                    $_SESSION['dba'] = $row['varable_value'];
                  //  $_SESSION['logged_user'] = $email;
                    $_SESSION['dbu'] = $row['update_adult'];
                    $_SESSION['dbs'] = $row['IsActive'];
                    $_SESSION['dbc'] = $row['createdon'];
                  //  $_SESSION['xr'] = $row['createdon'];
                  //  $_SESSION['xa'] = $row['isActive'];


            //require 'include/account_header.php';
            require 'include/topmenu.php';
            require 'include/leftmenu.php';
            require 'pages/'.$page.'.php';
            require 'include/setting.php';
            require 'include/footer.php';
            require 'include/modal.php';

        }



    }


    ?>

尝试过代码,但没有看到任何错误,还检查了我的connect.php代码,看看是否连接到正确的数据库。但它仍会显示带有网址http://localhost/login白色空白页。没有显示任何错误消息,请以任何方式解决此问题

0 个答案:

没有答案