优化路由,支持以下写法

Route::domain('www', function(){
    Route::register(':action', 'index/Index/:action');
    Route::register(':hash', 'index/Index/redirect?type=short');
    Route::register('d/:hash', 'index/Index/redirect?type=qrcode');
});
This commit is contained in:
huangdijia
2016-02-02 11:43:05 +08:00
parent 5f97437aee
commit 164526ea33

View File

@@ -327,6 +327,11 @@ class Route
// 检测URL路由
public static function check($url, $depr = '/', $checkDomain = false)
{
// 检测域名部署
if ($checkDomain) {
self::checkDomain();
}
// 分隔符替换 确保路由定义使用统一的分隔符
if ('/' != $depr) {
$url = str_replace($depr, '/', $url);
@@ -350,11 +355,6 @@ class Route
$rules = array_merge(self::$rules['*'], $rules);
}
// 检测域名部署
if ($checkDomain) {
self::checkDomain();
}
// 检测URL绑定
$return = self::checkUrlBind($url, $rules);
if ($return) {