ThinkPHP5.1路由写法的改进
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']);
,在PHPstorm里可以观察到方法是否被引用: