Home  >  Article  >  php教程  >  Some suggestions about routing groups in ThinkPHP 5

Some suggestions about routing groups in ThinkPHP 5

WBOY
WBOYOriginal
2016-10-17 09:12:071737browse

Go straight to the content
Route::rule('ha','index/Index/hello');<br> <br> # Set up Index routing group<br> Route::group('index',[<br> 'ha' => ['index/Index/hello'],<br> ],['method'=>'get']);In the default module, the ha in the group must be accessed through the index/prefix.
For single records, rules are not required.

In this way, if you want to manage the routes of the index group through the routing group, you must access them all through index/prefix


I suggest that TP officials can bind the default module to the index routing group in a later version, so that the front-end URL will be more beautiful.... (Although the above two routes are independent, once bound It will be difficult to monitor the priority level, or there may only be one of them, but I hope the URL will look better...)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn