Kohana 3.2 Route - controllers in subdirectories

2019-09-07 03:17发布

I need to create next structure:


    +controller
      ++admin
       +++catalog
        ++++category.php
        ++++product.php
       +++users

and I need to open them by url /admin/catalog/category/action/param I tried to create route:

 Route::set('admin', '(<directory>(/<controller>(/<action>(/<custom_param>))))',array(
        'directory' => '(admin/.*)'
    ))
    ->defaults(array(
        'controller'  => 'dashboard',
        'action'        => 'index'
    ));

1条回答
We Are One
2楼-- · 2019-09-07 04:02

Not tested:

Route::set('admin', 'admin/<directory>/(<controller>(/<action>(/<custom_param>)))',
    array(
        'directory' => '(catalog|users)'
    ))
    ->defaults(array(
        'controller' => 'dashboard',
        'action'     => 'index',
    ));
查看更多
登录 后发表回答