当前位置: 首页>>代码示例>>PHP>>正文


PHP Loader::loadController方法代码示例

本文整理汇总了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);
 }
开发者ID:danielsuszek,项目名称:BookManager,代码行数:9,代码来源:Bootstrap.php

示例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;
             }
     }
 }
开发者ID:prafiny,项目名称:wolf_framework,代码行数:62,代码来源:router.php

示例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);
开发者ID:redspade-,项目名称:monkimvc,代码行数:29,代码来源:index.php

示例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);
开发者ID:tigar-bilderski,项目名称:repozaframework,代码行数:24,代码来源:init.php


注:本文中的Loader::loadController方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。