当前位置: 首页>>代码示例>>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;未经允许,请勿转载。