modules/api/init.php
http://localhost/vlc/vod/index.php/api/a/a
分别对应下面2种路由
Route::set('collect', 'collect(/<controller>(/<action>(/<param>)))' ,array('param'=>'.*'))
->defaults(array(
'controller' => 'collect',
'action' => 'index',
));
Route::set('api', 'api(/<controller>(/<action>(/<param>)))' ,array('param'=>'.*'))
->defaults(array(
'controller' => 'collect',
'action' => 'index',
));
其中api/class/controller/a.php
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_A extends Controller {
function action_index()
{
echo("dd");
}
function action_a()
{
echo("aa");
}
}
bootstarp.php中去除默认路由
Kohana::modules(array(
'admin' => MODPATH.'admin',
'api' => MODPATH.'api',
'auth' => MODPATH.'auth', // 用户登录
'cache' => MODPATH.'cache', // Caching with multiple backends
'xcache' => MODPATH.'xcache', // Caching with multiple backends
'database' => MODPATH.'database',
));
/**
* 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>(/<params>)))' , array('params' => '.*?'))
->defaults(array(
'controller' => 'auth',
'action' => 'index',
));
*/
Cache::$default = 'memcache';//( Kohana::$environment == Kohana::PRODUCTION)?'memcache':'file';
Cookie::$salt = 'VLC-Salt-STRING-Here';