top-think/think

[建议]tp5.1路由的写法升级,支持PHPstorm查看方法是否被引用

felixwann opened this issue · 0 comments

文件:thinkphp/library/think/route/Rule.php第794行,增加这段代码:

elseif (is_array($route) && count($route) == 2) {
    $result = $this->dispatchMethod($request, $route[0] . '@' . $route[1]);
} 

定义路由:

Route::get('hello/:name', [\app\index\controller\Index::class, 'hello']);

image
这样就可以在PHPstorm中查看该方法是否被注册成路由

https://www.cnblogs.com/felixwan/p/16997865.html