本文整理汇总了PHP中Dispatcher::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Dispatcher::run方法的具体用法?PHP Dispatcher::run怎么用?PHP Dispatcher::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dispatcher
的用法示例。
在下文中一共展示了Dispatcher::run方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ini_set
<?php
ini_set('display_errors', '1');
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
include_once 'config/defines.php';
function __autoload($className)
{
$dirs = array('core', 'models', 'controllers', 'core/form');
foreach ($dirs as $dir) {
$file = $dir . '/' . $className . '.php';
if (file_exists($file)) {
include_once $file;
}
}
}
$database = new Database();
session_start();
Dispatcher::run();
示例2: define
<?php
/**
* Created by PhpStorm.
* User: Europpa
* Date: 24/10/14
* Time: 07:13 PM
*/
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', realpath(dirname(__FILE__)) . DS);
define('APP_PATH', ROOT . 'application' . DS);
header('Content-type: text/html; charset=utf-8');
//echo print_r(get_required_files());
try {
require_once APP_PATH . 'config.php';
require_once APP_PATH . 'Request.php';
require_once APP_PATH . 'Controller.php';
require_once APP_PATH . 'Dispatcher.php';
require_once APP_PATH . 'View.php';
require_once APP_PATH . 'Model.php';
require_once APP_PATH . 'Database.php';
require_once APP_PATH . 'Sessiones.php';
Sessiones::construir_session();
Dispatcher::run(new Request());
} catch (Exception $e) {
echo $e->getMessage();
}
示例3: max
try
{
$config_cache = Cache::getInstance("cached_config");
$route_config = "configs/routes.xml";
$store_config = "configs/db.xml";
$min_time = max(filemtime($route_config), filemtime($store_config));
if ($config = $config_cache->get($min_time))
{
$routes = $config->routes;
}
else
{
$config = Config::getInstance();
$config->loadXML($store_config, "storage");
$routes = $config->loadXML($route_config, "routes");
$config_cache->put($config);
}
//$dispatcher = new Dispatcher_Cached($routes["site"]);
$dispatcher = new Dispatcher($routes['site']);
$dispatcher->run();
} catch (Exception $e) {
report_exception($e);
}
$end_time = microtime(true);
//include("debug.php");
?>
示例4: Request
}
$cur_stage = NetAidManager::get_stage();
$request = new Request($_GET['query']);
$dispatcher = new Dispatcher();
$controller = $request->getController();
$action = $request->getAction();
$updater = new Updater();
if ($cur_stage >= STAGE_ONLINE && $_SESSION['logged_in'] == 1 && $updater->updateAvailable()) {
if ($controller != 'update') {
$request->setController('update');
$request->setAction('index');
}
} else {
if ($cur_stage != STAGE_ONLINE && $_SERVER['SERVER_NAME'] != '192.168.101.1') {
header('Location: http://192.168.101.1/' . $controller . '/' . $action);
die;
}
}
$page_html = '';
try {
$page_html = $dispatcher->run($request);
} catch (NotFoundException $e) {
if ($cur_stage != STAGE_ONLINE) {
header('Location: http://192.168.101.1/index/index');
die;
}
$e->do_404();
}
$params = array('page_html' => $page_html);
$layout = new View('layout', $params);
$layout->display();
示例5: Dispatcher
// Controllers
if (!$return && file_exists(CONTROLLER_DIR . '/' . $filename)) {
require_once CONTROLLER_DIR . '/' . $filename;
$return = true;
}
// Models
if (!$return && file_exists(MODELS_DIR . '/' . $filename)) {
require_once MODELS_DIR . '/' . $filename;
$return = true;
}
// Libs
if (!$return && file_exists(LIBS_DIR . '/' . $filename)) {
require_once LIBS_DIR . '/' . $filename;
$return = true;
}
// Collections
if (!$return && file_exists(COLLECTIONS_DIR . '/' . $filename)) {
require_once COLLECTIONS_DIR . '/' . $filename;
$return = true;
}
if (defined("PROFILER") && PROFILER) {
$profilerClassAllocatedSize[$class_name] = memory_get_usage() - $memNow;
}
return $return;
}
// register the custom autoload method
spl_autoload_register('__autoload');
// start application
$application = new Dispatcher($db);
$application->run();
示例6: microtime
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* very basic session management at this point */
session_start();
/* get the start time of the php script execution */
define('SCRIPT_START', microtime(true));
/* include paths config file */
include '../application/config/paths.php';
/* include general config file */
include DIR_CONFIG . 'general.live.php';
/* include database config file */
include DIR_CONFIG . 'database.live.php';
/* include api auth config file */
include DIR_CONFIG . 'api_auths.live.php';
/* include functions file */
include DIR_FUNCTIONS . 'general.php';
/* set error reporting */
error_reporting(SYSTEM_ERRORLEVEL);
/* set default timezone */
date_default_timezone_set(SYSTEM_TIMEZONE);
try {
/* instantiate disbatcher class */
$Dispatcher = new Dispatcher();
/* perform functions and render page */
$Dispatcher->run();
} catch (ExceptionAbstract $ExceptionAbstract) {
/* display error message for thrown exception */
$ExceptionAbstract->triggerEvent();
}