当前位置: 首页>>代码示例>>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;未经允许,请勿转载。