duanrao3371 2009-05-08 03:47
浏览 32
已采纳

如何将tld.com/bures/oceanfront转换为Kohana中的tld.com/articles/view/bures/oceanfront?

I'm using Kohana 2.3.2

Most, if not all, of the links on my site are to articles.

My controller is called Articles, and I have a method titled View. I don't want to prefix all my links with /articles/view/, so I'd like to set a default controller to handle all files.

I've looked into using a default router, which made tld.com use the Articles controller. However, when I try and access something like /bure/oceanfront/, I get Kohana's 404 Error.

I have looked at this article, but I believe it is outdated as the examples given are always error'ing (also see comments which point this out).

  • 写回答

1条回答 默认 最新

  • dpsyssiv90846 2009-05-08 04:07
    关注

    This is working now:

    Event::add('system.post_routing' ,'call_fallback_page');
    
    
    
    function call_fallback_page() {
            Router::$controller = 'Articles';
            Router::$method = 'index';
            Router::$controller_path = APPPATH.'controllers/articles.php';
    }
    

    Derived from the tutorial in the question.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算