本文整理汇总了PHP中Loader::loadController方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::loadController方法的具体用法?PHP Loader::loadController怎么用?PHP Loader::loadController使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader::loadController方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
$this->prepareUrl();
// load controller with /setup/Loader::loadController()
$controller = Loader::loadController($this->_controller);
// runAction($action, Array $arg)
// method from main Controler /lib/Controller.php
$controller->runAction($this->_action, $this->_args);
}
示例2: parseRequest
/**
* Each time a page will be load, this method will be called each time
*
* TODO : How are we supposed to provide the request string like so if it is a singleton?
* Maxime Martineau
*
* @method parseRequest
* @access public
* @param string $request URL of the requested page
* @return void
* @author Quentin LOZACH
* @version 0.1
*/
public function parseRequest($request = FALSE)
{
// Load the Loader class
include BASE_PATH . '/core/loader/loader.php';
// Instanciation of the loader which will load every file on the project
$loader = new Loader();
// Are we on the index page or note ?
switch ($request) {
// We are on the index page
case FALSE:
// Load the mainController, the index method, mainView
$this->controller = "mainController";
$this->method = "index";
$this->params = NULL;
$loader->loadController($this->controller);
break;
// We are on another page so load the Controller and the model with the same name
// We are on another page so load the Controller and the model with the same name
default:
// Load the mainController, mainView and mainModel
$requestExploded = explode("/", $request);
// If the user is trying to load a file directly in the URL such as : .php, .html, .css, .js, .sql ...
$requestSecured = explode(".", $request);
// If there is only a controller with no method, raise an error with error() method
if (empty($requestExploded[1]) && !empty($requestExploded[0])) {
$this->error("empty-method");
} else {
// If requestSecured[1] is not empty the user tried to load a file in the URL
if (isset($requestSecured[1])) {
// The controller is the name of the 1st param but cleaned with the explode
$this->controller = $requestSecured[0];
} else {
// The controller is the first parameter of the URL
$this->controller = $requestExploded[0];
}
// The method is the second parameter of the URL
$this->method = $requestExploded[1];
}
// Getting parameters, so let's keep only useful informations
unset($requestExploded[0]);
unset($requestExploded[1]);
// Getting the rest of the parameters in the $_GET['request'] in the URL
if (!empty($requestExploded[2])) {
$this->params = $requestExploded;
} else {
$this->params = NULL;
}
}
}
示例3:
if($_SERVER['SERVER_ADDR']=='127.0.0.1')
{
/*PHP error settings*/
error_reporting(E_ALL ^ E_NOTICE);
ini_set('display_errors','On');
$sConfig = 'development';
}
else
{
}
//load config
$aConfig = parse_ini_file("applications/{$sConfig}.ini", true);
//constants
$oLoader->loadClass('Constants');
//call Bootstrap
include('applications/Bootstrap.php');
$oController = $oLoader->loadController($controller);
//call action
$oController->$action();
$oLoader->renderView($oController, $action);
示例4: realpath
<?php
require_once "Loader.php";
require_once 'Router.php';
include_once realpath("controllers/baseController.php");
include_once realpath("models/baseModel.php");
Loader::loadClass('Session');
Loader::loadClass('Cookie');
Session::start();
//Loader::loadClass('Cookie');
//Cookie::set('interval', "100", "1", "/", false, false);
//Cookie::set('intervalDrugi', "100", "1", "/", false, false);
//$cookie = Cookie::get("interval");
//var_dump($cookie);
//$del = Cookie::delete("intervalDrugi");
//var_dump($del);
/**
* $_GET['rt'] automatski setova u .htaccess fajlu regularnim izrazom
*/
$route = new Router($_GET['rt']);
$controller = $route->getController();
$method = $route->getMethod();
$params = $route->getParams();
Loader::loadController($controller, $method, $params);