mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +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路由
|
// 检测URL路由
|
||||||
public static function check($url, $depr = '/', $checkDomain = false)
|
public static function check($url, $depr = '/', $checkDomain = false)
|
||||||
{
|
{
|
||||||
|
// 检测域名部署
|
||||||
|
if ($checkDomain) {
|
||||||
|
self::checkDomain();
|
||||||
|
}
|
||||||
|
|
||||||
// 分隔符替换 确保路由定义使用统一的分隔符
|
// 分隔符替换 确保路由定义使用统一的分隔符
|
||||||
if ('/' != $depr) {
|
if ('/' != $depr) {
|
||||||
$url = str_replace($depr, '/', $url);
|
$url = str_replace($depr, '/', $url);
|
||||||
@@ -350,11 +355,6 @@ class Route
|
|||||||
$rules = array_merge(self::$rules['*'], $rules);
|
$rules = array_merge(self::$rules['*'], $rules);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测域名部署
|
|
||||||
if ($checkDomain) {
|
|
||||||
self::checkDomain();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检测URL绑定
|
// 检测URL绑定
|
||||||
$return = self::checkUrlBind($url, $rules);
|
$return = self::checkUrlBind($url, $rules);
|
||||||
if ($return) {
|
if ($return) {
|
||||||
|
|||||||
Reference in New Issue
Block a user