Kohana Framework 中有带有控制器的子目录

发布于 2024-12-09 08:16:56 字数 595 浏览 0 评论 0原文

好吧,它曾经位于我的控制器所在的应用程序/控制器/类/中。

现在我想要有更好的结构,所以我将用户控制器移动到 user/ 目录。

所以这个:

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

更改为:

Route::set('user', 'user(/<action>)')
->defaults(array(
    'directory'     => 'user',
    'controller' => 'user',
    'action'     => 'index',
));

现在我收到错误,例如找不到用户/登录。

上面示例的控制器位于 application/controller/classes/user/user.php 中。

我尝试删除底部默认路由,以防万一它经历这种情况,但不,它仍然不起作用。

Ok so it used to be in application/controller/classes/ where my controllers are.

Now i would like to have better structure, so i moved my user controllers to the user/ directory.

So this:

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

Got changed to:

Route::set('user', 'user(/<action>)')
->defaults(array(
    'directory'     => 'user',
    'controller' => 'user',
    'action'     => 'index',
));

Now i receive error, e.g user/login not found.

The controller for the above example, is in application/controller/classes/user/user.php.

I tried to remove the bottom default route just in case it was going through that, but no it still doesnt not work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

要走就滚别墨迹 2024-12-16 08:16:56

您是否更改了控制器类的名称?目录名称必须在控制器名称中,在您的情况下,它应该是 Controller_User_User。

Have you changed name of your controller class? The directory name must be in the controllers name, in your case it should be Controller_User_User.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文