Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
你如何设置这样的动态路由:
/admin/user/edit -> controller=admin_user, action=edit /admin/user/view -> controller=admin_user, action=view /admin/page/edit -> controller=admin_page, action=edit
在哪里/admin/page转换为控制器admin_page,或自动:/admin/(.*)到admin_$1
/admin/page
admin_page
/admin/(.*)
admin_$1
您可以将所有admin控制器放入admin目录中,以便您的控制器具有类似的名称user,page等等。
admin
user
page
结构如下:
controller/ admin/ user.php page.php
路线:
Route::set('admin', 'admin/<controller>/<action>') ->defaults(array( 'directory' => 'admin', ));