本文整理匯總了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;
}