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


PHP Dispatcher::execute方法代码示例

本文整理汇总了PHP中Dispatcher::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP Dispatcher::execute方法的具体用法?PHP Dispatcher::execute怎么用?PHP Dispatcher::execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dispatcher的用法示例。


在下文中一共展示了Dispatcher::execute方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildRoute

 public function buildRoute($uri, $params = null)
 {
     try {
         $params = (array) $params;
         $params['uri'] = $uri;
         $uri = Dispatcher::execute($this->build, $params);
     } catch (\Exception $e) {
         //
     }
     return $uri;
 }
开发者ID:rutkoski,项目名称:simplify,代码行数:11,代码来源:RouteFilter.php

示例2: execute

 /**
  * Realiza el dispatch de una ruta
  *
  * @return Object
  */
 public static function execute($route)
 {
     extract($route, EXTR_OVERWRITE);
     if (!(include_once APP_PATH . "controllers/{$controller_path}" . '_controller.php')) {
         throw new KumbiaException(NULL, 'no_controller');
     }
     //Asigna el controlador activo
     $app_controller = Util::camelcase($controller) . 'Controller';
     $cont = self::$_controller = new $app_controller($module, $controller, $action, $parameters);
     View::select($action);
     View::setPath($controller_path);
     // Se ejecutan los filtros before
     if ($cont->k_callback('initialize') === FALSE) {
         return $cont;
     }
     if ($cont->k_callback('before_filter') === FALSE) {
         return $cont;
     }
     //Se ejecuta el metodo con el nombre de la accion
     //en la clase de acuerdo al convenio
     if (!method_exists($cont, $action)) {
         throw new KumbiaException(NULL, 'no_action');
     }
     //Obteniendo el metodo
     $reflectionMethod = new ReflectionMethod($cont, $action);
     //k_callback y __constructor metodo reservado
     if ($reflectionMethod->name == 'k_callback' || $reflectionMethod->isConstructor()) {
         throw new KumbiaException('Esta intentando ejecutar un método reservado de KumbiaPHP');
     }
     //se verifica que el metodo sea public
     if (!$reflectionMethod->isPublic()) {
         throw new KumbiaException(NULL, 'no_action');
     }
     //se verifica que los parametros que recibe
     //la action sea la cantidad correcta
     $num_params = count($parameters);
     if ($cont->limit_params && ($num_params < $reflectionMethod->getNumberOfRequiredParameters() || $num_params > $reflectionMethod->getNumberOfParameters())) {
         throw new KumbiaException("Número de parámetros erroneo para ejecutar la acción \"{$action}\" en el controlador \"{$controller}\"");
     }
     $reflectionMethod->invokeArgs($cont, $parameters);
     //Corre los filtros after
     $cont->k_callback('after_filter');
     $cont->k_callback('finalize');
     //Si esta routed volver a ejecutar
     if (Router::getRouted()) {
         Router::setRouted(FALSE);
         return Dispatcher::execute(Router::get());
         // Vuelve a ejecutar el dispatcher
     }
     return $cont;
 }
开发者ID:albertmolina,项目名称:Daily-Content-Manager,代码行数:56,代码来源:dispatcher.php

示例3: main

 /**
  * Función Principal donde se ejecutan los controladores
  *
  * @params string $url url
  * @return boolean
  */
 public static function main($url)
 {
     /**
      * El Router analiza la url
      **/
     Router::rewrite($url);
     /**
      * Ciclo del enrutador
      */
     $controller = Dispatcher::execute();
     while (Router::getRouted()) {
         Router::setRouted(false);
         $controller = Dispatcher::execute();
     }
     /**
      * Renderiza la vista
      **/
     if ($controller->view || $controller->template) {
         require CORE_PATH . 'kumbia/view.php';
         View::render($controller, $url);
     } else {
         ob_end_flush();
     }
     // Fin del request
     exit;
 }
开发者ID:raalveco,项目名称:Escuela,代码行数:32,代码来源:kumbia.php

示例4: auto

}
// @see Router
require CORE_PATH . 'kumbia/router.php';
//@see Load
require CORE_PATH . 'kumbia/load.php';
// @see Dispatcher
require CORE_PATH . 'kumbia/dispatcher.php';
// @see Controller
require APP_PATH . 'libs/application_controller.php';
// @see KumbiaView
require APP_PATH . 'libs/view.php';
try {
    // Bootstrap de la aplicacion
    require APP_PATH . 'libs/bootstrap.php';
    // Dispatch y renderiza la vista
    View::render(Dispatcher::execute(Router::rewrite($url)), $url);
} catch (KumbiaException $e) {
    KumbiaException::handle_exception($e);
}
// Autocarga de clases
function auto($class)
{
    // Optimizando carga de ActiveRecord
    if ($class == 'ActiveRecord') {
        return require APP_PATH . 'libs/active_record.php';
    }
    // Pasando a smallcase
    $class = Util::smallcase($class);
    if (is_file(APP_PATH . "extensions/helpers/{$class}.php")) {
        return require APP_PATH . "extensions/helpers/{$class}.php";
    }
开发者ID:albertmolina,项目名称:Daily-Content-Manager,代码行数:31,代码来源:bootstrap.php

示例5: MRequest

<?php

/**
* M PHP Framework
* @package      M
*/
/**
* M PHP Framework
*
* Controller main file for default app
*
* @package      M
* @author       Arnaud Sellenet <demental at github>

* @license      http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
* @version      0.1
*/
define('APP_NAME', '{$APP_NAME}');
require '{$APP_RELATIVE_FILE_TO_ROOT}/M_Startup.php';
require APP_ROOT . 'app/' . APP_NAME . '/routing.php';
$result = Net_URL_Mapper::getInstance()->match($_GET['route']);
$getvalues = array_merge($result, $_GET);
$requestvalues = array_merge($_POST, $get);
$request = new MRequest($getvalues, $requestvalues);
$d = new Dispatcher($request);
$d->setConfig(PEAR::getStaticProperty('Dispatcher', 'global'));
$d->execute();
header('Content-type:text/html; charset=utf-8');
echo $d->display();
开发者ID:demental,项目名称:m,代码行数:29,代码来源:index.php

示例6: Dispatcher

<?php

/**
 *  ====== COPYRIGHT ======
 *  Suicide MVC, A Simple RAD Framework
 *  Copyright (c) Devin Ireland, http://devinireland.com
 *
 *  Licensed under The Microsoft Public License
 *  See LICENSE-SMVC.txt in the root folder of this source code.
 *  Redistributions of files must retain this copyright notice.
 *  =======================
 *  
 *  ----- File Description -----
 *  This is the root index file that handles requests by 
 *  handing the GET variables off to the dispatcher.
 */
require_once 'Config/global.php';
require_once 'Config/global_script.php';
// Dispatcher initializes the controller and view.
$dispatcher = new Dispatcher(isset($_GET['page']) ? $_GET['page'] : NULL, isset($_GET['action']) ? $_GET['action'] : NULL, isset($_GET['argument']) ? $_GET['argument'] : NULL);
$dispatcher->execute();
开发者ID:TheFirstDeity,项目名称:SuicideMvc,代码行数:21,代码来源:index.php

示例7: execute

 public function execute($callback)
 {
     return Dispatcher::execute($callback, $this->params);
 }
开发者ID:rutkoski,项目名称:simplify,代码行数:4,代码来源:MatchedRoute.php

示例8: redirect404

 public function redirect404($modulaction, $vars = null, $lang = null, $secure = null)
 {
     header('Status: 404');
     header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
     $arr = explode('/', $modulaction);
     $d = new Dispatcher($arr[0], $arr[1], $this->_params);
     $d->execute();
     echo $d->display();
     exit(0);
 }
开发者ID:demental,项目名称:m,代码行数:10,代码来源:Module.php


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