Kohana:Kohana_HTTP_Exception[404]:在此服务器上找不到请求的URL日历


Kohana : Kohana_HTTP_Exception [ 404 ]: The requested URL calendar was not found on this server

我正在学习kohana,我正在使用ver:3.3.0。

我得到这个错误:

Kohana_HTTP_Exception [ 404 ]: The requested URL calendar was not found on this server.
SYSPATH'classes'Kohana'Request'Client'Internal.php [ 79 ]
SYSPATH'classes'Kohana'Request'Client'Internal.php [ 79 ]
SYSPATH'classes'Kohana'Request'Client.php [ 114 ] » Kohana_Request_Client_Internal->execute_request(arguments)
SYSPATH'classes'Kohana'Request.php [ 990 ] » Kohana_Request_Client->execute(arguments)
DOCROOT'index.php [ 118 ] » Kohana_Request->execute() 

我键入的URL:

(//localhost/organizer_tst/calendar/)

我的文件:

application''classes''Controller''Calendars''Calendar.hp:

class Controller_Calendar extends Controller
{
    public function action_index()
    {
        $tst = new Model_Calendar();
               echo $tst->testing("LOLLOLOOLL");              
    }
}

application''classes''Model''calendar.hp:

Class Model_Calendar extends Model
{
    public function testing($param)
    {
        $tst ="I want to display it: "."$param";
        return $tst ;        
    }   
}

bootstrap.hp:

Kohana::init(array(
    'base_url'   => '/organizer_tst/',
));
Route::set('something', 'calendar(/<directory>(/<controller>(/<action>(/<id>))))')
    ->defaults(array(
        'directory'  => 'Calendars',
        'controller' => 'Calendar',
        'action'     => 'index',
    ));
Route::set('default', '(<controller>(/<action>(/<id>)))')
    ->defaults(array(
        'controller' => 'welcome',
        'action'     => 'index',
    ));

我在错误页面上检查了"环境->包含的文件",我可以看到我的控制器文件:APPPATH''classes''Controllers''Calendars''Calendar.php

在这种情况下,如果控制器不在一个额外的目录中,一切都在工作:application''classes''Controller''Calendars''Calendar.php

我使用Xampp作为根目录:D:''examplep''htdocs我有我项目的别名:Alias/organizer_tst/acalendar"D:''examplep''htdocs''organizer_tst"

你能告诉我为什么我有这个错误异常吗?

Kohana的命名约定告诉您应该如何命名和定位类。

在这种情况下,Kohana正在位置application/classes/Controller/Calendars/Calendar.php中查找名为Controller_Calendars_Calendar的类。它找到文件,但找不到类。您应该将类命名为Controller_Calendars_Calendar或将文件移动到application/classes/Controller/Calendar.php

控制器:blog.php在blog.php中,有一种方法定义如下:

public function action_new()
    {
        $view =View::factory('blog/new');
        $this->response->body($view);
    }

views:一个名为"Blog"的文件夹,在博客中有一个文件名为new.php

按此顺序检查您的文件。