0

我的路由设置如下:

Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
    'controller' => 'static',
    'action'     => 'index',
));

这样输入:

http://localhost/et/testkohana4/

应有的呼吁action_indexController_Static

但是,当我输入:

http://localhost/et/testkohana4/test

我希望它会说“找不到 Controller_Test ”,但 Kohana 错过了它,我从 Apache 收到一条消息,上面写着“在此服务器上找不到请求的 URL /testkohana4/index.php/test。

即使我将一个文件放入其中包含该类的controller目录下,我仍然会收到 page-not-found 错误。test.phpController_Test

当我在 URL 中输入名称时,如何让 Kohana 调用特定控制器?

4

1 回答 1

2

编辑:此答案评论中提供的正确解决方案是将 .htaccess RewriteBase 值更改为

RewriteBase /et/testkohana4/

(<controller>(<action>(/<id>)))

你的路线有错误。开头没有正斜杠(<action> ...那应该是(/<action> ...

这些<blocks>是 URL 中的动态段。所以在这个例子中:

http://localhost/et/testkohana4/test

将导致这被称为:

  • 控制器:等
  • 行动:testkohana4
  • 编号:测试

那应该对你有用。希望有帮助。

于 2010-11-11T13:53:57.307 回答