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