當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FrontController::overrideServerVars方法代碼示例

本文整理匯總了PHP中FrontController::overrideServerVars方法的典型用法代碼示例。如果您正苦於以下問題:PHP FrontController::overrideServerVars方法的具體用法?PHP FrontController::overrideServerVars怎麽用?PHP FrontController::overrideServerVars使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FrontController的用法示例。


在下文中一共展示了FrontController::overrideServerVars方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dirname

include dirname(__FILE__) . '/jax/classes/FrontController.class.php';
$__frontController__ = new FrontController();
$__bareRequestURI__ = $__frontController__->getBareRequestURI();
// If we have a direct request for index.php or index, redirect to the parent directory,
// but keep the query string if it exists.
if (preg_match('/((\\/index\\.php$)|(\\/index$))/', $__bareRequestURI__)) {
    header('HTTP/1.1 301 Found');
    header('Location: ' . preg_replace('/((\\/index\\.php$)|(\\/index$))/', '/', $__bareRequestURI__) . (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != '' ? '?' . $_SERVER['QUERY_STRING'] : ''));
    exit;
}
// See if it matches any PHP scripts, either directly, or by adding a .php extension at
// any level along the path.
// If we find a PHP page, override the values in $_SERVER to make it look as if the server
// executed the PHP page directly, then include the PHP page and exit.
if (($__res_9q929123342__ = $__frontController__->findPHPScript($__bareRequestURI__)) !== false) {
    $__frontController__->overrideServerVars($__res_9q929123342__->fn, $__res_9q929123342__->uri, $__res_9q929123342__->pathinfo, isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '');
    unset($__frontController__);
    unset($__bareRequestURI__);
    if (realpath($__res_9q929123342__->fn) != realpath(__FILE__)) {
        @chdir(dirname($__res_9q929123342__->fn));
        include $__res_9q929123342__->fn;
    }
    exit;
}
unset($__res_9q929123342__);
// No PHP page found for handling the URI.
// If there's a custom front controller plugin include file, execute it now.
if (@file_exists(dirname(__FILE__) . '/frontcontroller_custom.include.php')) {
    @(include dirname(__FILE__) . '/frontcontroller_custom.include.php');
}
// Issue a 404 Not Found error and exit.
開發者ID:roncemer,項目名稱:jaxframework,代碼行數:31,代碼來源:frontcontroller.php


注:本文中的FrontController::overrideServerVars方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。