dongyao4419 2016-02-02 12:13
浏览 33

如何更改kohana 3.2中的Route :: set

we have used kohana 3.2. We need to changed the url xyz.com/ar measn the site working arabic lanugag and xyz.com/en means the site working in english language. Now the default 3 param is id. I need to changes this.

  Route::set('custom', '(<controller>(/<action>(/<id>)))')
        ->defaults(array(
            'controller' => 'admin',
            'action'     => 'index',
    ));
    Route::set('live', 'ar/auctions/live')
    ->defaults(array('controller' => 'auctions','action'  => 'closed','method' => NULL));
  • 写回答

1条回答 默认 最新

  • dozc1071 2016-03-23 21:55
    关注

    1 Route::set() have 3 parametrs. Last is Regex patterns for route keys

    2 The sequence is important, so first live, second custom

    3 Try this:

    Route::set('other', '((<lang>)(/)(<controller>(/<action>(/<id>))))', 
                         Array('lang'=>'(en|ar)'))->defaults(array(
        'lang'       => $default_lang,
        'controller' => 'foo',
        'action'     => 'index',
    ));
    
    I18n::lang(Request::instance()->param('lang'));
    
    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?