mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
优化路由,支持以下写法
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user