Kohana 3路线不匹配

编程入门 行业动态 更新时间:2024-10-07 22:30:36
本文介绍了Kohana 3路线不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在匹配Kohana 3自定义路由时遇到问题,似乎每件事都是正确的,但URL与路由不匹配.以下是我的bootstrap.php文件中的设置:

Hi I am having problem while matching Kohana 3 custom route, it seems like every thing is correct but URL doesnot match with route. Following are settings in my bootstrap.php file:

Kohana::init(array( 'base_url' => '/basepath/', 'index_file' => 'index.php' )); /** * Attach the file write to logging. Multiple writers are supported. */ Kohana::$log->attach(new Log_File(APPPATH.'logs')); /** * Attach a file reader to config. Multiple readers are supported. */ Kohana::$config->attach(new Config_File); /** * Enable modules. Modules are referenced by a relative or absolute path. */ Kohana::modules(array( 'auth' => MODPATH.'auth', // Basic authentication // 'cache' => MODPATH.'cache', // Caching with multiple backends // 'codebench' => MODPATH.'codebench', // Benchmarking tool 'database' => MODPATH.'database', // Database access 'image' => MODPATH.'image', // Image manipulation 'orm' => MODPATH.'orm', // Object Relationship Mapping // 'unittest' => MODPATH.'unittest', // Unit testing 'userguide' => MODPATH.'userguide', // User guide and API documentation )); /** * Set the routes. Each route must have a minimum of a name, a URI and a set of * defaults for the URI. */ Route::set('default', '(<controller>(/<action>(/<id>)))') ->defaults(array( 'controller' => 'welcome', 'action' => 'index', )); Route::set('category_images', 'cat/<category>', array('category'=>'[a-z\-_\.]+')) ->defaults(array( 'controller' => 'categoryimages', 'action' => 'index', )); Route::set('user_images', '<username>/images(/<pageid>)', array('username'=>'[a-z\-_\.]+', 'pageid'=>'[1-9][0-9]*')) ->defaults(array( 'controller' => 'userimages', 'action' => 'index', )); Route::set('dynamic_image', 'image/thumbnail/<size>/<id>/<image>', array('size'=>'s|m|z', 'id'=>'[0-9]+', 'image'=>'.+')) ->defaults(array( 'controller' => 'image', 'action' => 'thumbnail' ));

错误消息已附加:

这是目标控制器,如果存在问题,则显示命名约定:

Here is target controller, to show naming conventions if there is problem in that:

<?php class Controller_Categoryimages extends Controller_Template { public $template = 'template'; public $images_per_page = 15; // show images of a user public function action_index() { //code here }

请告诉是否有人知道为什么它与URL不匹配.

Please tell if some one have any idea that why it is not matching the URL.

先谢谢大家.

推荐答案

您的默认路由应该是最后一条,因为这是全部.我建议您将其完全删除.当前,它首先匹配默认值,然后尝试用动作天空加载Contoller_Cat类.

Your default route should be last, as it's a catch all. I'd recommend you delete it completely. It's currently matching default first, and trying to load the Contoller_Cat class with action sky.

更多推荐

Kohana 3路线不匹配

本文发布于:2023-11-25 21:31:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1631424.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不匹配   路线   Kohana

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!