top-think / think

ThinkPHP Framework ——十年匠心的高性能PHP框架
http://www.thinkphp.cn
Other
7.83k stars 1.62k forks source link

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

Closed felixwann closed 1 year ago

felixwann commented 1 year ago

文件: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