本文整理匯總了PHP中router::alias方法的典型用法代碼示例。如果您正苦於以下問題:PHP router::alias方法的具體用法?PHP router::alias怎麽用?PHP router::alias使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類router
的用法示例。
在下文中一共展示了router::alias方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: init
/**
* 路由初始化
*
*
*/
public static function init()
{
$uri = '';
if (PHP_SAPI === 'cli') {
//cli
} elseif (isset($_GET['zotop'])) {
$uri = $_GET['zotop'];
} elseif (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO']) {
$uri = $_SERVER['PATH_INFO'];
} elseif (isset($_SERVER['ORIG_PATH_INFO']) && $_SERVER['ORIG_PATH_INFO']) {
$uri = $_SERVER['ORIG_PATH_INFO'];
}
router::$uri = trim($uri, '/');
router::$uri = preg_replace('#//+#', '/', router::$uri);
router::$uri = router::alias(router::$uri);
}
示例2: init
public static function init()
{
$uri = '';
if (PHP_SAPI === 'cli') {
//cli
} elseif (isset($_GET['zotop'])) {
$uri = $_GET['zotop'];
} elseif (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO']) {
$uri = $_SERVER['PATH_INFO'];
} elseif (isset($_SERVER['ORIG_PATH_INFO']) && $_SERVER['ORIG_PATH_INFO']) {
$uri = $_SERVER['ORIG_PATH_INFO'];
} elseif (isset($_SERVER['PHP_SELF']) && $_SERVER['PHP_SELF']) {
$uri = $_SERVER['PHP_SELF'];
}
if (($pos = strpos($uri, ZOTOP_APP_BASE)) !== FALSE) {
$uri = (string) substr($uri, $pos + strlen(ZOTOP_APP_BASE));
}
router::$uri = trim($uri, '/');
router::$uri = preg_replace('#//+#', '/', router::$uri);
router::$uri = router::alias(router::$uri);
}
示例3: findURI
/**
* 獲取當前的URl參數,如:index.php/cms/index/index/1/2,所有的URI最後不含有斜線
*
* @return string URI;
*/
public static function findURI()
{
$uri = '';
if (isset($_GET['zotop'])) {
$uri = $_GET['zotop'];
zotop::config('zotop.url.model', 2);
//將url模式重新設置為兼容模式
} elseif (isset($_SERVER['PATH_INFO']) and $_SERVER['PATH_INFO']) {
$uri = $_SERVER['PATH_INFO'];
} else {
$uri = $_SERVER['PHP_SELF'];
if (strpos($uri, APPBASE) !== FALSE) {
$uri = (string) substr($uri, strpos($uri, APPBASE) + strlen(APPBASE));
}
}
//URI別名,實現自定義路由功能
$uri = router::alias($uri);
//應用程序入口文件處理,去掉開始結尾的斜線
$uri = trim($uri, '/');
$uri = preg_replace('#//+#', '/', $uri);
self::$uri = $uri;
}