本文整理汇总了PHP中FrontController::route方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontController::route方法的具体用法?PHP FrontController::route怎么用?PHP FrontController::route使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrontController
的用法示例。
在下文中一共展示了FrontController::route方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FrontController
<?php
try {
include 'app/bootstrap.php';
$app = new FrontController($service);
$app->route();
} catch (Exception $e) {
error_log($e->__toString());
header('HTTP/1.1 503 Service Unavailable');
include VIEW_DIR . '503page.tpl.php';
}
示例2: dirname
<?php
define('ROOT', dirname(__FILE__));
if (substr($_SERVER['SCRIPT_FILENAME'], 0, strlen(ROOT)) == ROOT) {
$urlSegmentToRemove = substr($_SERVER['SCRIPT_FILENAME'], strlen(ROOT));
if (substr($_SERVER['SCRIPT_NAME'], -strlen($urlSegmentToRemove)) == $urlSegmentToRemove) {
$baseURL = substr($_SERVER['SCRIPT_NAME'], 0, -strlen($urlSegmentToRemove));
$baseURL = rtrim($baseURL, DIRECTORY_SEPARATOR);
if ($baseURL == '') {
$baseURL = '/';
}
define('BASE_URL', $baseURL);
}
}
include_once ROOT . '/lib.php';
$root = ROOT;
@session_start();
$front = new FrontController();
$url = ltrim(substr($_SERVER['REQUEST_URI'], strlen(BASE_URL)), '/');
if (strpos($url, '?')) {
$url = substr($url, 0, strpos($url, '?'));
}
$out = $front->route($url);
if (!headers_sent()) {
echo $out;
}