Kohana 3.2 Route-子目录中的控制器 [英] Kohana 3.2 Route - controllers in subdirectories

查看:98
本文介绍了Kohana 3.2 Route-子目录中的控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建下一个结构:

I need to create next structure:



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

,我需要通过url/admin/catalog/category/action/param打开它们 我试图创建路线:

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'
    ));

推荐答案

未测试:

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

这篇关于Kohana 3.2 Route-子目录中的控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆