本文整理汇总了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);
}
}