我是从Kohana开始的,我不明白为什么会有这个错误......
Kohana_HTTP_Exception [ 404 ]: The requested URL api/v1/welcome was not found on this server.
SYSPATH/classes/Kohana/Request/Client/Internal.php [ 89 ]
if ( ! class_exists($prefix.$controller))
{
throw HTTP_Exception::factory(404,
'The requested URL :uri was not found on this server.',
array(':uri' => $request->uri())
)->request($request);
}
// Load the controller using reflection
$class = new ReflectionClass($prefix.$controller);
我的.htaccess
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]
我的路线
Route::set('api','api/v1(/<controller>(/<id>)(/<custom>))'
)->defaults(
array(
'directory' =>'api/v1',
'controller' => 'welcome',
'id' => FALSE,
'action' => 'index',
)
);
我的控制器:Controller / api / v1 / Welcome.php
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Api_v1_Welcome extends Controller {
public function action_index()
{
$this->response->body('hello, world!');
}
} // End Welcome
我错过了什么?为什么我的控制器类上的class_exist返回FALSE ???
答案 0 :(得分:0)
Kohana 3.3.2 =&gt;整个代码现在区分大小写了
Route::set('api','api/v1(/<controller>(/<id>)(/<custom>))'
)->defaults(
array(
'directory' =>'Api/V1',
'controller' => 'Welcome',
'id' => FALSE,
'action' => 'index',
)
);