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


PHP path::stripCommonPrefix方法代码示例

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


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

示例1: getRequestedScriptUri

 /**
  * Retrieves part of request URI selecting current application and script.
  *
  * The fetched request URI is provided as array of pathname elements, that is
  * pathname might be derived by joining returned elements with '/'.
  *
  * @note Fetched request URI might include further selectors to be processed
  *       by requested script, e.g.
  *
  *       myapp/myscript/par1-of-script/par2-of-script
  *
  * @param string $detectedProxy name of detected proxy script
  * @return array sequence of filenames contained in requested URI for selecting script
  */
 public function getRequestedScriptUri(&$detectedProxy)
 {
     switch (txf::getContextMode()) {
         case txf::CTXMODE_REWRITTEN:
             assert('$_SERVER[REDIRECT_URL] || $_SERVER[PATH_INFO] || $_SERVER[REQUEST_URI]');
             // get originally requested script (e.g. prior to rewrite)
             if (trim($_SERVER['REQUEST_URI']) !== '') {
                 // use of lighttpd's rewriting detected
                 $query = strtok($_SERVER['REQUEST_URI'], '?');
                 // mark rewrite mode by not selecting any valid used proxy
                 $detectedProxy = true;
             } else {
                 if (trim($_SERVER['REDIRECT_URL']) !== '') {
                     // use of mod_rewrite detected
                     $query = $_SERVER['REDIRECT_URL'];
                     // mark rewrite mode by not selecting any valid used proxy
                     $detectedProxy = true;
                 } else {
                     // request for proxy script (run.php) detected
                     $query = $_SERVER['PATH_INFO'];
                     // remember proxy script used this time, if any
                     $detectedProxy = $this->scriptPathname;
                 }
             }
             // derive list of application and script selectors
             return path::stripCommonPrefix(explode('/', $query), $this->prefixPathname);
             // txf::CTXMODE_NORMAL
         // txf::CTXMODE_NORMAL
         default:
             // expect application and script selectors being part of requested
             // script pathname
             return preg_split('#/+#', $this->applicationScriptPathname);
     }
 }
开发者ID:cepharum,项目名称:txf,代码行数:48,代码来源:context.php


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