本文整理匯總了PHP中HomeController::load_view方法的典型用法代碼示例。如果您正苦於以下問題:PHP HomeController::load_view方法的具體用法?PHP HomeController::load_view怎麽用?PHP HomeController::load_view使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類HomeController
的用法示例。
在下文中一共展示了HomeController::load_view方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct($route)
{
if (!isset($_SESSION)) {
//buscar opciones en el PHP.INI
session_start(['use_only_cookies' => 1, 'auto_start' => 1]);
}
if (!isset($_SESSION['status'])) {
$_SESSION['status'] = false;
}
if ($_SESSION['status']) {
$this->route = !isset($_GET['r']) ? 'home' : $route;
switch ($this->route) {
case 'home':
$controller = new HomeController();
$controller->load_view('home');
break;
case 'usuarios':
$controller = new HomeController();
if (!isset($_POST['r'])) {
$controller->load_view('users');
} else {
if ($_POST['r'] == 'user-add') {
$controller->load_view('user-add');
} else {
if ($_POST['r'] == 'user-edit') {
$controller->load_view('user-edit');
} else {
if ($_POST['r'] == 'user-delete') {
$controller->load_view('user-delete');
}
}
}
}
break;
case 'generos':
$controller = new HomeController();
if (!isset($_POST['r'])) {
$controller->load_view('genres');
} else {
if ($_POST['r'] == 'genre-add') {
$controller->load_view('genre-add');
} else {
if ($_POST['r'] == 'genre-edit') {
$controller->load_view('genre-edit');
} else {
if ($_POST['r'] == 'genre-delete') {
$controller->load_view('genre-delete');
}
}
}
}
break;
case 'peliculas':
$controller = new HomeController();
$controller->load_view('movies');
break;
case 'salir':
$controller = new Session();
$controller->logout();
break;
default:
$controller = new Error404Controller();
break;
}
} else {
if (!isset($_POST['user']) && !isset($_POST['pass'])) {
$controller = new HomeController();
$controller->load_view('login');
} else {
$controller = new Session();
$session = $controller->login($_POST['user'], $_POST['pass']);
if (is_array($session)) {
$_SESSION['status'] = true;
foreach ($session as $row) {
$_SESSION['user'] = $row['user'];
$_SESSION['email'] = $row['email'];
$_SESSION['name'] = $row['name'];
$_SESSION['birthday'] = $row['birthday'];
$_SESSION['pass'] = $row['pass'];
$_SESSION['role'] = $row['role'];
}
header('Location: ./');
} else {
$controller = new HomeController();
$controller->load_view('login');
header("Location: ./?error={$session}");
}
}
}
}