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


PHP FrontController::dispatch方法代码示例

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


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

示例1: testDispatchingWorksCorrectly

 /**
  * @covers FrontController::__construct
  * @covers FrontController::dispatch
  */
 public function testDispatchingWorksCorrectly()
 {
     $request = new Request(array('REQUEST_URI' => '/test'));
     $response = new Response();
     $router = new Router();
     $router->set('test', 'TestController');
     $frontController = new FrontController($request, $response, $router, new ControllerFactory(new MapperFactory(new PDO('sqlite::memory:'))), new ViewFactory());
     $this->assertInstanceOf('TestView', $frontController->dispatch($router));
 }
开发者ID:le-toan-mulodo,项目名称:bankaccount,代码行数:13,代码来源:FrontControllerTest.php

示例2: Request

require_once ST_DIR . '/Interfaces/IEventSubscriber.php';
require_once ST_DIR . '/includes/functions.php';
require_once ST_DIR . '/Classes/Request.php';
require_once ST_DIR . '/Classes/Session.php';
require_once ST_DIR . '/Controller/ControllerAbstract.php';
require_once ST_DIR . '/Controller/FrontController.php';
require_once ST_DIR . '/Model/ModelAbstract.php';
require_once ST_DIR . '/Model/Statement.php';
require_once ST_DIR . '/Model/Comment.php';
require_once ST_DIR . '/Classes/Events.php';
require_once ST_DIR . '/Classes/MailsEvent.php';
require_once ST_DIR . '/Classes/SubscribeEvent.php';
mb_internal_encoding($config['charset']);
ModelAbstract::$db = $db;
$request = new Request();
$front = new FrontController($request, $member_id);
$front->setTpl($tpl);
$js_array[] = 'engine/modules/Statement/Resources/js/statement.js';
try {
    $front->dispatch();
} catch (Exception $e) {
    switch ($e->getCode()) {
        case 404:
            header("HTTP/1.0 404 Not Found");
            $front->msg('Error', $e->getMessage(), 'error');
            break;
        default:
            $front->msg('Error', $e->getMessage(), 'error');
            break;
    }
}
开发者ID:dautushenka,项目名称:DLE-Statement,代码行数:31,代码来源:statement.php

示例3: dispatch

<?php 
include_once 'mvc/trackList-controller.php';
// abilitare il mod_rewrite con
// sudo a2enmod rewrite
//
//
// gksudo gedit /etc/apache2/sites-available/development &
// cambiare il valore della directory development da AllowOverride none a all
// sudo service apache2 restart
// redirigiamo la richiesta con un switch
FrontController::dispatch($_REQUEST);
class FrontController
{
    public static function dispatch(&$request)
    {
        if (isset($request["page"])) {
            switch ($request["page"]) {
                case "trackList":
                    $controller = new TrackListController();
                    $controller->handleInput($request);
                    break;
            }
        } else {
            write404();
        }
    }
    public static function write404()
    {
        // impostiamo il codice della risposta http a 404 (file not found)
        header('HTTP/1.0 404 Not Found');
开发者ID:nadiajolanda,项目名称:esAMM2014,代码行数:30,代码来源:index.php

示例4: dirname

<?php

require_once dirname(__FILE__) . '/lightmvc/FrontController.php';
FrontController::$isDebug = false;
FrontController::$dirname = dirname(__FILE__);
$front = FrontController::dispatch();
开发者ID:rjoganah,项目名称:Healthcare_social_network,代码行数:6,代码来源:index.php

示例5: Request

<?php

require __DIR__ . '/../src/autoload.php';
// Set some super-global variables for demo purposes.
if (PHP_SAPI == 'cli') {
    $_SERVER['REQUEST_URI'] = '/bankaccount/id/1';
}
$request = new Request($_SERVER, $_GET, $_POST, $_COOKIE, $_FILES, $_ENV);
$response = new Response();
$mapperFactory = new MapperFactory(new PDO('sqlite:' . dirname(__DIR__) . '/database/bankaccount.db'));
$router = new Router();
$router->set('bankaccount', 'BankAccountController');
$router->set('bankaccounts', 'BankAccountListController');
$controllerFactory = new ControllerFactory($mapperFactory);
$viewFactory = new ViewFactory();
$frontController = new FrontController($request, $response, $router, $controllerFactory, $viewFactory);
$view = $frontController->dispatch($router);
print $view->render();
开发者ID:kaviarasankk,项目名称:bankaccount,代码行数:18,代码来源:index.php

示例6: Request

<?php

require __DIR__ . '/../src/autoload.php';
// Set some super-global variables for demo purposes.
if (PHP_SAPI == 'cli') {
    $_SERVER['REQUEST_URI'] = '/bankaccount/id/1';
}
$request = new Request($_SERVER, $_GET, $_POST, $_COOKIE, $_FILES, $_ENV);
$response = new Response();
$mapperFactory = new MapperFactory(new PDO('sqlite:' . dirname(__DIR__) . '/database/bankaccount.db'));
$router = new Router();
$router->set('bankaccount', 'BankAccountController');
$router->set('bankaccounts', 'BankAccountListController');
$controllerFactory = new ControllerFactory($mapperFactory);
$viewFactory = new ViewFactory();
$frontController = new FrontController($request, $response, $router, $controllerFactory, $viewFactory);
$view = $frontController->dispatch();
print $view->render();
开发者ID:randyamiel,项目名称:bankaccount,代码行数:18,代码来源:index.php


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