嗨,我正在处理页面切换代码,由于某种原因,默认页面似乎没有加载,有人可以帮忙吗?目前我可以输入一个随机 URL,但它只是显示找不到页面。
默认显示会触发 PHPMyAdmin 页面错误
,即views/404.php
文件夹。
但它没有。我似乎可以理解为什么它没有。
<?php
//begin the webpage
//index page selector placed into an array for options for the user to select
//session started recording attributes
session_start();
error_reporting(0);
//including other view class and model class function to be used on this page
include 'views/viewClass.php';
include 'classes/modelClass.php';
class PageSelector {
public function run() {
//has the user decided which page to go to?
//if not then we will direct him to the homepage
if(!$_GET['page']) {
$_GET['page'] = 'Home';
}
//extending a new model class
$model = new Model;
//get the page information
$pageInfo = $model -> getPageInfo($_GET['page']);
//select which page to include when the user clicks
//on either register/home/my account/my bids/my sell/completed auctions/edit etc..etc..etc..
switch($_GET['page']) {
case 'Register':
include 'views/register.php';
$view = new HomeView($pageInfo, $model);
break;
case 'Home':
include 'views/homeView.php';
$view = new HomeView($pageInfo, $model);
break;
case 'My Account':
include 'views/myaccount.php';
$view = new myaccount($pageInfo, $model);
break;
case 'My Bids':
include 'views/mybids.php';
$view = new Mybids($pageInfo, $model);
break;
case 'My Sell':
include 'views/mysell.php';
$view = new mysell($pageInfo, $model);
break;
case 'Completed Auctions':
include 'views/checkout.php';
$view = new checkout($pageInfo, $model);
break;
case 'editProduct':
include 'views/editProductView.php';
$view = new EditProductView($pageInfo, $model);
break;
case 'addProduct':
include 'views/addProductView.php';
$view = new AddProductView($pageInfo, $model);
break;
case 'deleteProduct':
include 'views/deleteProductView.php';
$view = new DeleteProductView($pageInfo, $model);
break;
case 'deleteUser':
include 'views/deleteUserView.php';
$view = new DeleteUserView($pageInfo, $model);
break;
case 'search':
include 'views/search.php';
$view = new search($pageInfo, $model);
break;
case 'product':
include 'views/productView.php';
$view = new ProductView($pageInfo, $model);
break;
default:
include 'views/404.php';
$view = new error($pageInfo,$model);
}
echo $view -> displayPage();
}
}
$pageSelect = new PageSelector();
$pageSelect -> run();
//calls the selector to run after user has selected.