当前位置: 首页>>代码示例>>PHP>>正文


PHP context::getRequestedScriptUri方法代码示例

本文整理汇总了PHP中context::getRequestedScriptUri方法的典型用法代码示例。如果您正苦于以下问题:PHP context::getRequestedScriptUri方法的具体用法?PHP context::getRequestedScriptUri怎么用?PHP context::getRequestedScriptUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在context的用法示例。


在下文中一共展示了context::getRequestedScriptUri方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 protected function __construct(context $context)
 {
     $this->context = $context;
     $envApplicationName = getenv('TXF_APPLICATION');
     $this->gotNameFromEnvironment = !!$envApplicationName;
     /*
      * extract selected application and source
      */
     // choose source of application/script selector
     $frames = $context->getRequestedScriptUri($this->usedProxy);
     if (empty($frames)) {
         throw new http_exception(400, 'Request missing application. Check your setup!');
     }
     // extract information on application folder and name
     if ($this->gotNameFromEnvironment) {
         $this->name = $envApplicationName;
     } else {
         $this->name = array_shift($frames);
     }
     if ($this->name == 'txf') {
         throw new http_exception(404, 'Requested application doesn\'t exist.');
     }
     // add some derived properties for conveniently addressing application
     $this->pathname = path::glue($context->installationPathname, $this->name);
     // find selected script's pathname and name
     if (empty($frames)) {
         $this->script = 'index.php';
     } else {
         $script = array();
         while (count($frames)) {
             $script[] = array_shift($frames);
             $pathname = path::glue($this->pathname, implode('/', $script));
             if (is_file($pathname)) {
                 break;
             }
             if (is_file("{$pathname}.php")) {
                 $script[] = array_pop($script) . '.php';
                 break;
             }
         }
         $this->script = implode('/', $script);
     }
     // extract additional selectors to be available in script
     if (txf::getContextMode() == txf::CTXMODE_REWRITTEN) {
         $this->selectors = $frames;
     } else {
         $this->selectors = explode('/', $_SERVER['PATH_INFO']);
     }
     $urlDecodeSelector = !!getenv('TXF_URLDECODE_SELECTORS');
     $this->selectors = array_map(function ($a) use($urlDecodeSelector) {
         if ($urlDecodeSelector) {
             $a = urldecode($a);
         }
         return data::autoType(trim($a));
     }, $this->selectors);
     // prepare application's base URL
     if ($this->gotNameFromEnvironment) {
         $this->url = $context->url;
     } else {
         $this->url = path::glue($context->url, $this->name);
     }
 }
开发者ID:cepharum,项目名称:txf,代码行数:62,代码来源:application.php


注:本文中的context::getRequestedScriptUri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。