本文介绍了Kohana 3:具有子目录错误的路由,控制器不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
因此,我尝试使用子目录构建路由,并遵循Kerkness Wiki指南,但始终会出错.如果有人指出我在做什么错,我将不胜感激.
So I'm trying to build a route with sub directories and following the Kerkness wiki guide but keep getting errors. If someone could point out what I'm doing wrong I would greatly appreciate it.
http://kerkness.ca/wiki/doku.php?id=路由:building_routes_with_subdirectories
代码:
Route::set('default', '(<directory>(/<controller>(/<action>(/<id>))))', array('directory' => '.+?'))
->defaults(array(
'directory' => 'admin',
'controller' => 'main',
'action' => 'index',
));
网址:
/admin/weather/feedback
文件:
/application/classes/controller/admin/weather/feedback.php
class Controller_Admin_Weather extends Controller_Admin_Base {
错误:
ReflectionException [ -1 ]: Class controller_admin_weather does not exist
推荐答案
天气必须是控制者而不是反馈.在admin文件夹中创建一个weather.php文件,并将控制器命名为Controller_Admin_Weather,然后将其命名为action_feedback.
Weather needs to be the controller not feedback. Make a weather.php in the admin folder and put the controller as Controller_Admin_Weather and then the action action_feedback.
这篇关于Kohana 3:具有子目录错误的路由,控制器不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!