Kohana Framework 中有带有控制器的子目录
好吧,它曾经位于我的控制器所在的应用程序/控制器/类/中。
现在我想要有更好的结构,所以我将用户控制器移动到 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技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否更改了控制器类的名称?目录名称必须在控制器名称中,在您的情况下,它应该是 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.