Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/265.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在科哈纳将tld.com/bures/oceanfront转换为tld.com/articles/view/bures/oceanfront?_Php_Kohana - Fatal编程技术网

Php 如何在科哈纳将tld.com/bures/oceanfront转换为tld.com/articles/view/bures/oceanfront?

Php 如何在科哈纳将tld.com/bures/oceanfront转换为tld.com/articles/view/bures/oceanfront?,php,kohana,Php,Kohana,我使用的是Kohana 2.3.2 我网站上的大部分(如果不是全部的话)链接都指向文章 我的控制器名为Articles,我有一个名为View的方法。我不想在所有链接前面加上/articles/view/,所以我想设置一个默认控制器来处理所有文件 我已经研究过使用默认路由器,这使得tld.com使用Articles控制器。然而,当我尝试访问像/bure/oceanfront/这样的东西时,我得到了Kohana的404错误 我已经看过了,但我认为它已经过时了,因为给出的例子总是错误的(另请参阅指出这

我使用的是Kohana 2.3.2

我网站上的大部分(如果不是全部的话)链接都指向文章

我的控制器名为Articles,我有一个名为View的方法。我不想在所有链接前面加上/articles/view/,所以我想设置一个默认控制器来处理所有文件

我已经研究过使用默认路由器,这使得tld.com使用Articles控制器。然而,当我尝试访问像/bure/oceanfront/这样的东西时,我得到了Kohana的404错误

我已经看过了,但我认为它已经过时了,因为给出的例子总是错误的(另请参阅指出这一点的评论)

现在正在运行:

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';
}
源自问题中的教程