本文整理匯總了PHP中Dispatcher::invoke方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dispatcher::invoke方法的具體用法?PHP Dispatcher::invoke怎麽用?PHP Dispatcher::invoke使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dispatcher
的用法示例。
在下文中一共展示了Dispatcher::invoke方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: define
<?php
define('ROOT_DIR', dirname(dirname(__DIR__)) . '/');
define('APP_DIR', ROOT_DIR . '/app/');
// PHP5.4 built-in web server support
if (php_sapi_name() === 'cli-server') {
$cli_filepath = preg_replace('/(\\?.*)\\z/', '', $_SERVER['REQUEST_URI']);
if (is_file(__DIR__ . $cli_filepath)) {
return false;
}
$_REQUEST['dc_action'] = preg_replace('/\\A\\//', '', $cli_filepath);
}
require_once ROOT_DIR . 'vendor/dietcake/dietcake/dietcake.php';
require_once CONFIG_DIR . 'bootstrap.php';
require_once CONFIG_DIR . 'core.php';
Dispatcher::invoke();
示例2:
<?php
require __DIR__ . '/../core/Dispatcher.php';
Dispatcher::invoke(['controller_dir' => __DIR__ . '/controller/', 'view_dir' => __DIR__ . '/views/', 'ignore_path' => '\\/sample']);
示例3: Dispatcher
<?php
/**
* Copyright (c) 2015 by Robin Wieschendorf. All Rights
* Reserved. Proprietary and Confidential - This source code is not for
* redistribution.
*/
require_once '../library/core.php';
/*****************
* SCRIPT - START *
******************/
$dispatcher = new Dispatcher();
$dispatcher->setDefaultRoute(['app', 'module', 'id', 'action']);
$dispatcher->setIndexApp('public');
$dispatcher->setIndexModule('index');
$dispatcher->invoke();