本文整理汇总了PHP中Error::index方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::index方法的具体用法?PHP Error::index怎么用?PHP Error::index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error::index方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error
function error()
{
require 'controllers/' . EQ_404 . '.php';
$error = new Error();
$error->index();
return false;
}
示例2: error
function error()
{
require 'error.php';
$controlador = new Error();
$controlador->index();
return false;
}
示例3: error
public function error()
{
require 'controllers/error.php';
$controller = new Error();
$controller->index();
return false;
}
示例4: error
function error()
{
require "controller/error.php";
$controller = new Error();
$controller->index();
return false;
}
示例5: rtrim
function __construct()
{
$url = filter_input(INPUT_GET, 'url');
$url = rtrim($url, '/');
$url = explode('/', $url);
if (empty($url[0])) {
require 'controllers/controllerIndex.php';
$controller = new Index();
$controller->index();
return false;
}
$file = 'controllers/controller' . $url[0] . '.php';
if (file_exists($file)) {
require $file;
} else {
require 'controllers/controllerError.php';
$controller = new Error();
$controller->index($url[0]);
return false;
}
$controller = new $url[0]();
if (isset($url[1])) {
if (method_exists($controller, $url[1])) {
if (isset($url[2])) {
$controller->{$url[1]}($url[2]);
} else {
$controller->{$url[1]}();
}
} else {
$controller->index();
}
} else {
$controller->index();
}
}
示例6: error
function error($msg = false)
{
require 'controllers/error.php';
$error = new Error();
$error->index($msg);
return false;
}
示例7: __construct
public function __construct()
{
$this->getUrlWithoutModRewrite();
if (!$this->url_controller) {
require APP . 'controllers/home.php';
$page = new Home();
$page->index();
} elseif (file_exists(APP . 'controllers/' . $this->url_controller . '.php')) {
require APP . 'controllers/' . $this->url_controller . '.php';
$this->url_controller = new $this->url_controller();
if (method_exists($this->url_controller, $this->url_action)) {
if (!empty($this->url_params)) {
// Llama el metodo y le pasa los argumentos
call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
} else {
//Si no hay parametros llama a el metodo sin argumentos.
$this->url_controller->{$this->url_action}();
}
} else {
if (strlen($this->url_action) == 0) {
// Si no se define alguna accion defino por defecto la index
$this->url_controller->index();
} else {
//Si la accion no existe lanzo el error
require APP . 'controllers/error.php';
$page = new Error();
$page->index();
}
}
} else {
require APP . 'controllers/error.php';
$page = new Error();
$page->index();
}
}
示例8: isset
function __construct()
{
$url = isset($_GET['url']) ? $_GET['url'] : null;
$url = rtrim($url, "/");
$url = explode("/", $url);
if (empty($url[0])) {
require '../controllers/index.php';
$controller = new Index();
$controller->index();
return false;
}
// CONTROLLER
// Only allow a controller name with dashes & alphanumeric characters
if (preg_match('/[^0-9a-z-]/i', $url[0])) {
require '../controllers/error.php';
$controller = new Error("Invalid Character In Controller Name.");
return false;
}
// For the script to read past this line, the controller must be alphanumeric w/ dash
$file = '../controllers/' . $url[0] . '.php';
if (file_exists($file)) {
require $file;
} else {
// controller file not found
// HOW CAN I LOG ERRORS HERE? PUT THEM INTO A DATABASE?
require '../controllers/error.php';
$controller = new Error("Controller not found: " . $url[0]);
return false;
//throw new Exception("The file '$file' does not exist!");
}
$controller = new $url[0]();
$controller->loadModule($url[0]);
// CALLING METHODS -------------------------------
if (isset($url[2])) {
// CHECK IF METHOD EXISTS
if (method_exists($controller, $url[1])) {
$controller->{$url[1]}($url[2]);
} else {
require '../controllers/error.php';
$controller = new Error("Method not found: " . $url[1]);
}
return false;
} elseif (isset($url[1])) {
if (method_exists($controller, $url[1])) {
$controller->{$url[1]}();
} else {
require '../controllers/error.php';
$controller = new Error("Method not found: " . $url[1]);
}
return false;
} else {
$controller->index();
}
}
示例9: isset
function __construct()
{
$url = isset($_GET['url']) ? $_GET['url'] : null;
$url = explode('/', $url);
//print_r($url);
//if empty redirect to index
if (empty($url[0])) {
require 'controllers/index.php';
$controller = new Index();
$controller->index();
return false;
}
$file = 'controllers/' . $url[0] . '.php';
if (file_exists($file)) {
require $file;
$controller = new $url[0]();
if (isset($url[1])) {
if ($url[1] == "") {
$controller->index();
} else {
if (isset($url[2])) {
if ($url[2] == "") {
$controller->{$url}[1]();
} else {
$controller->{$url}[1]($url[2]);
}
} else {
if (method_exists($controller, $url[1])) {
// $controller->index();
$controller->{$url}[1]();
} else {
require 'controllers/error.php';
$controller = new Error();
$controller->index();
return false;
}
}
}
}
if (!isset($url[1])) {
$controller->index();
}
} else {
require 'controllers/error.php';
$controller = new Error();
$controller->index();
return false;
}
}
示例10: __construct
/**
* "Start" the application:
* Analyze the URL elements and calls the according controller/method or the fallback
*/
public function __construct()
{
// create array with URL parts in $url
$this->getUrlWithoutModRewrite();
// check for controller: no controller given ? then load start-page
if (!$this->url_controller) {
require APP . 'controllers/home.php';
$page = new Home();
$page->index();
} elseif (file_exists(APP . 'controllers/' . $this->url_controller . '.php')) {
// here we did check for controller: does such a controller exist ?
// if so, then load this file and create this controller
// example: if controller would be "car", then this line would translate into: $this->car = new car();
require APP . 'controllers/' . $this->url_controller . '.php';
/**
* Bad workaround due to list being a reserved keyword. Should probably rename to something other than list in production.
**/
if ($this->url_controller == 'list') {
$this->url_controller = new days();
} else {
$this->url_controller = new $this->url_controller();
}
// check for method: does such a method exist in the controller ?
if (method_exists($this->url_controller, $this->url_action)) {
if (!empty($this->url_params)) {
// Call the method and pass arguments to it
call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
} else {
// If no parameters are given, just call the method without parameters, like $this->home->method();
$this->url_controller->{$this->url_action}();
}
} else {
if (strlen($this->url_action) == 0) {
// no action defined: call the default index() method of a selected controller
$this->url_controller->index();
} else {
// defined action not existent: show the error page
require APP . 'controllers/error.php';
$page = new Error();
$page->index();
}
}
} else {
require APP . 'controllers/error.php';
$page = new Error();
$page->index();
}
}
示例11: __construct
/**
* "Start" the application:
* Analyze the URL elements and calls the according controller/method or the fallback
*/
public function __construct()
{
// create array with URL parts in $url
$this->getUrlWithoutModRewrite();
$GLOBALS["beans"] = new stdClass();
$this->openDatabaseConnection();
$this->loadModels();
$this->loadHelpers();
date_default_timezone_set('UTC');
// check for controller: no controller given ? then load start-page
if (!$this->url_controller) {
require APP . 'controllers/home.php';
$page = new Home();
$page->index();
} elseif (file_exists(APP . 'controllers/' . $this->url_controller . '.php')) {
// here we did check for controller: does such a controller exist ?
// If user is not logged in, restrict to the login page only
$this->checkLoggedIn();
// if so, then load this file and create this controller
// example: if controller would be "car", then this line would translate into: $this->car = new car();
require APP . 'controllers/' . $this->url_controller . '.php';
$this->url_controller = new $this->url_controller();
// check for method: does such a method exist in the controller ?
if (method_exists($this->url_controller, $this->url_action)) {
if (!empty($this->url_params)) {
// Call the method and pass arguments to it
call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
} else {
// If no parameters are given, just call the method without parameters, like $this->home->method();
$this->url_controller->{$this->url_action}();
}
} else {
if (strlen($this->url_action) == 0) {
// no action defined: call the default index() method of a selected controller
$this->url_controller->index();
} else {
// defined action not existent: show the error page
require APP . 'controllers/error.php';
$page = new Error();
$page->index();
}
}
} else {
require APP . 'controllers/error.php';
$page = new Error();
$page->index();
}
}
示例12: __construct
/**
* "Inicia" la aplicacion:
* Analiza los elementos de la URL y pide el controlador/metodo
*/
public function __construct()
{
$this->openDatabaseConnection();
$url = $this->splitUrl();
$cont = 0;
if ($url[0] == 'gnhanoit') {
require './application/libs/gnhanoit/gnhanoit.php';
$gnhanoit = new gnhanoit();
if (isset($url[0]) == true && isset($url[2]) == false) {
$Table = $gnhanoit->index();
} else {
if (isset($url[0]) == true && isset($url[2]) == true && $url[2] == "crear") {
$gnhanoit->crear();
}
}
require './application/libs/gnhanoit/vwgnhanoit.php';
$cont = 1;
}
if ($cont == 0) {
$this->url_controller = isset($url[0]) ? $url[0] : null;
$this->url_action = isset($url[1]) ? $url[1] : null;
if (file_exists('./application/controller/' . $this->url_controller . 'Controller.php')) {
require './application/controller/' . $this->url_controller . 'Controller.php';
$this->url_controller = new $this->url_controller();
if (method_exists($this->url_controller, $this->url_action)) {
$parameter = array();
if (isset($url) == true && count($url) >= 3) {
for ($i = 2; $i < count($url); $i++) {
$parameter[] = $url[$i];
}
$this->url_controller->{$this->url_action}($parameter);
} else {
$this->url_controller->{$this->url_action}();
}
} else {
$this->url_controller->index();
}
} else {
require './application/controller/error.php';
$home = new Error();
$home->index();
}
}
}
示例13: createdb
public function createdb()
{
require 'config/env.php';
require 'config/database.php';
$conn = mysqli_connect($dbhost, $dbusername, $dbpass);
$sql = "CREATE DATABASE " . $dbname;
if (mysqli_query($conn, $sql)) {
echo '<script> alert("Database Created Sucessfully");</script>';
$this->redirect();
} else {
require 'config/env.php';
if ($debug = true) {
require 'app/controllers/errorcontroller.php';
$error = new Error();
$error->index();
} else {
}
}
}
示例14: __construct
/**
* "Start" the application:
* Analyze the URL elements and calls the according controller/method or the fallback
*/
public function __construct()
{
// create array with URL parts in $url
$this->splitUrl();
// check for controller: no controller given ? then load start-page
if (!$this->url_controller) {
require APP . 'controller/home.php';
$page = new Home();
$page->index();
} elseif (file_exists(APP . 'controller/' . $this->url_controller . '.php')) {
// here we did check for controller: does such a controller exist ?
// if so, then load this file and create this controller
// example: if controller would be "car", then this line would translate into: $this->car = new car();
require APP . 'controller/' . $this->url_controller . '.php';
$this->url_controller = new $this->url_controller();
// check for method: does such a method exist in the controller ?
if (method_exists($this->url_controller, $this->url_action)) {
if (!empty($this->url_params)) {
// Call the method and pass arguments to it
call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
} else {
// If no parameters are given, just call the method without parameters, like $this->home->method();
$this->url_controller->{$this->url_action}();
}
} else {
if (strlen($this->url_action) == 0) {
// no action defined: call the default index() method of a selected controller
$this->url_controller->index();
} else {
header('HTTP/1.0 404 Not Found');
require APP . 'controller/error.php';
$cont_error = new Error("Esa acción no existe");
$cont_error->index();
}
}
} else {
header('HTTP/1.0 404 Not Found');
require APP . 'controller/error.php';
$cont_error = new Error("Ese controlador no existe");
$cont_error->index();
}
}
示例15: load_controller
/**
* Controller betöltése
*/
private function load_controller()
{
// Először is betölti a megfelelő controller fájlt (ha betölthető), az url első paramétere alapján.
$file = 'system/' . $this->registry->area . '/controller/' . $this->registry->controller . '.php';
if (!file_exists($file)) {
require_once 'system/' . $this->registry->area . '/controller/error.php';
$error = new Error();
$error->index();
} else {
require_once $file;
// Példányosítjuk a controllert
$controller = new $this->registry->controller();
// meghívjuk az action metódust, ha nincs, akkor az index metódust hívjuk meg
if (method_exists($controller, $this->registry->action)) {
$controller->{$this->registry->action}();
} else {
$controller->index();
}
}
}