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