kohana还是路由route问题
来源:互联网 发布:java编程大赛题目 编辑:程序博客网 时间:2024/06/06 12:51
不能访问:http://localhost/index.php/manager/a/index
class Controller_A extends Controller {
public function action_index(){
echo 'A';
}
}
可以访问:http://localhost/index.php/manager/a/a/index
class Controller_A_A extends Controller {
public function action_index(){
echo 'A/A';
}
}
init.php
Route::set('manager', 'manager(/<controller>(/<action>(/<param>)))' ,array('param'=>'.*'))
->defaults(array(
'controller' => 'manager',
'action' => 'index',
));
Route::set('manager', 'manager(/<directory>(/<controller>(/<action>(/<param>))))',array('param'=>'.*'))
->defaults(array(
'controller' => 'manager',
'action' => 'index',
'directory' => '',
));
kohana还是路由route问题
无法访问url,找不到地址,于是“从简化”,即用上面的例子新建modules名,如manager文件夹,在里面新建文件a.php如上,用于测试
init.php里主要配置路由,然后一步步调试
第一种是没有文件夹的控制器文件,即controller/a.php
第二种是:controller/a/a.php
奇怪的是第2种可以访问,然后把init.php中第2个路由删除,第1种url还是不能访问,但过会后,不断的刷新,竟然可以正常访问了。
于是:判定route是正确的,错误原因可能是浏览器缓存造成的!!但调试方法可以用上面的。
能够正确打开url后,自动跳转到http://localhost/index.php/auth
可能是没有权限或未登录
bo中先加载modules,最后加载了一个全局通吃路由,之前有提过:
Route::set('default', '(<controller>(/<action>(/<params>)))' , array('params' => '.*?'))
->defaults(array(
'controller' => 'auth',
'action' => 'index',
));
即默认什么都没有的话,跳转到auth/index
http://localhost/index.php/auth/index 可以正常访问。
但是在modules/auth中并没有找到index方法。。。。这是为什么呢?
其实auth/index是在application中了。。。。。。。憋孙。
于是进入登录页面。。。
application/class/controller/auth/login()
$log_chk = Auth::instance()->login($this->request->post('email'), $this->request->post('password'), $remember);
还是调用的modules/auth/kohana/auth/login();
public function login($email, $password, $remember = FALSE)
{
if (empty($password))
return FALSE;
if (is_string($password))
{
// Create a hashed password
$password = $this->hash($password);
//echo $password;//直接输出hash的密码,存到数据库中,即可。
//exit;
}
return $this->_login($email, $password, $remember);
}
class Controller_A extends Controller {
public function action_index(){
echo 'A';
}
}
可以访问:http://localhost/index.php/manager/a/a/index
class Controller_A_A extends Controller {
public function action_index(){
echo 'A/A';
}
}
init.php
Route::set('manager', 'manager(/<controller>(/<action>(/<param>)))' ,array('param'=>'.*'))
->defaults(array(
'controller' => 'manager',
'action' => 'index',
));
Route::set('manager', 'manager(/<directory>(/<controller>(/<action>(/<param>))))',array('param'=>'.*'))
->defaults(array(
'controller' => 'manager',
'action' => 'index',
'directory' => '',
));
kohana还是路由route问题
无法访问url,找不到地址,于是“从简化”,即用上面的例子新建modules名,如manager文件夹,在里面新建文件a.php如上,用于测试
init.php里主要配置路由,然后一步步调试
第一种是没有文件夹的控制器文件,即controller/a.php
第二种是:controller/a/a.php
奇怪的是第2种可以访问,然后把init.php中第2个路由删除,第1种url还是不能访问,但过会后,不断的刷新,竟然可以正常访问了。
于是:判定route是正确的,错误原因可能是浏览器缓存造成的!!但调试方法可以用上面的。
能够正确打开url后,自动跳转到http://localhost/index.php/auth
可能是没有权限或未登录
bo中先加载modules,最后加载了一个全局通吃路由,之前有提过:
Route::set('default', '(<controller>(/<action>(/<params>)))' , array('params' => '.*?'))
->defaults(array(
'controller' => 'auth',
'action' => 'index',
));
即默认什么都没有的话,跳转到auth/index
http://localhost/index.php/auth/index 可以正常访问。
但是在modules/auth中并没有找到index方法。。。。这是为什么呢?
其实auth/index是在application中了。。。。。。。憋孙。
于是进入登录页面。。。
application/class/controller/auth/login()
$log_chk = Auth::instance()->login($this->request->post('email'), $this->request->post('password'), $remember);
还是调用的modules/auth/kohana/auth/login();
public function login($email, $password, $remember = FALSE)
{
if (empty($password))
return FALSE;
if (is_string($password))
{
// Create a hashed password
$password = $this->hash($password);
//echo $password;//直接输出hash的密码,存到数据库中,即可。
//exit;
}
return $this->_login($email, $password, $remember);
}
- kohana还是路由route问题
- kohana路由
- kohana中的路由规则
- Kohana安装配置路由
- kohana中的路由规则
- route 路由
- route路由
- kohana路由roule重写url
- kohana路由目录作为参数
- linux 路由 route命令
- linux 路由route
- 路由修改route
- 路由修改 route
- IP-route管理路由
- linux路由route配置
- 路由映射Route
- route设置路由
- linux route路由
- 基于visual Studio2013解决C语言竞赛题之1032平方和
- 查看sql Server监听端口方法
- Android获取手机的当前时间和获取时间的各种不同的格式
- 面试编程题拾遗(06) --- 打印n对括号的全部有效组合
- Android屏幕适配解析
- kohana还是路由route问题
- 安卓中,当activity处于不可见时将立即消毁
- javaScript获取元素位置以及元素页面大小总结
- Nginx 源码编译
- lua table 基本使用
- 费茨定律的另一面
- 建站基础二
- 节奏大师乐谱破解
- Google Summer of Code: C++ Modernizer Improvements----Monday, November 18, 2013