當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Container::getRouter方法代碼示例

本文整理匯總了PHP中Container::getRouter方法的典型用法代碼示例。如果您正苦於以下問題:PHP Container::getRouter方法的具體用法?PHP Container::getRouter怎麽用?PHP Container::getRouter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Container的用法示例。


在下文中一共展示了Container::getRouter方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 public function run()
 {
     if (!in_array(App::ROUTER_NO_DISPATCH, $this->options, true)) {
         $this->container->getRouter()->dispatch($this->container->getRequest(), $this->container->getResponse());
     }
 }
開發者ID:sinergi,項目名稱:core,代碼行數:6,代碼來源:RouterRuntime.php

示例2: api_get_languages

$languages = api_get_languages();
$ajaxPath = api_get_path(WEB_CODE_PATH) . 'inc/ajax/events.ajax.php';
$action_array = array(array('url' => 'event_controller.php?action=listing', 'content' => Display::return_icon('view_text.png', get_lang('ListView'), array(), ICON_SIZE_MEDIUM)));
$key_lang = get_lang('YouHaveSomeUnsavedChanges');
$users = UserManager::get_user_list(array(), array('firstname'));
$new_user_list = array();
foreach ($users as $user) {
    if ($user['status'] == ANONYMOUS) {
        continue;
    }
    $new_user_list[] = $user;
}
/**
 * Header definition
 */
$interbreadcrumb[] = array('url' => Container::getRouter()->generate('administration'), 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'event_controller.php', 'name' => get_lang('Events'));
$tool_name = get_lang('EventMessageManagement');
Display::display_header($tool_name);
echo Display::actions($action_array);
/**
 * JavaScript code
 * @todo move into HTML header
 */
?>
<script>
    var usersList = <?php 
echo json_encode($new_user_list);
?>
;
    var eventTypes = <?php 
開發者ID:jloguercio,項目名稱:chamilo-lms,代碼行數:31,代碼來源:event_type.php

示例3: Container

<?php

use Bravicility\Failure\FailureHandler;
use Bravicility\Http\Request;
use Bravicility\Http\Response\Response;
use Bravicility\Http\Response\TextResponse;
use Bravicility\Router\RouteNotFoundException;
require_once __DIR__ . '/../vendor/autoload.php';
$container = new Container();
$logger = $container->getErrorLogger();
FailureHandler::setup(function ($error) use($logger) {
    (new TextResponse(500, 'Произошла ошибка сервера'))->send();
    $logger->error($error['message'], $error);
    exit;
});
try {
    $request = Request::createFromGlobals();
    $route = $container->getRouter()->route($request->getMethod(), $request->getUrlPath());
    $request->setOptions($route->vars);
    /** @var Response $response */
    $response = (new $route->class($container))->{$route->method}($request);
} catch (RouteNotFoundException $e) {
    $response = new Response(404);
} catch (BadRequestException $e) {
    $response = new Response(400, $e->getMessage());
}
$response->addHeader('Access-Control-Allow-Origin: *');
$response->send();
開發者ID:apolev,項目名稱:fias,代碼行數:28,代碼來源:index.php


注:本文中的Container::getRouter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。