Kohana 3.3路由到子目录

时间:2022-10-13 12:16:52

I'm new to Kohana and am stuck with routing to a subdirectory, It keeps giving me a url not found on server.

我是Kohana的新手,我被困在路由到子目录,它一直给我一个在服务器上找不到的URL。

In the bootstrap.php I have this Route defined:

在bootstrap.php中我定义了这个Route:

Route::set('store', 'store(/<action>)')
    ->defaults(array(
        'directory'  => 'store',
        'controller' => 'main',
        'action'     => 'index',
    ));

the store controller is stored in application/classes/Controller/Store/Main.php

商店控制器存储在application / classes / Controller / Store / Main.php中

To test it the controller is only returning some text to the page:

为了测试它,控制器只返回一些文本到页面:

<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Store_Main extends Controller
{
    public function action_index()
    {
        $this->response->body('Store Main Page');
    }
}

1 个解决方案

#1


1  

The same works for me.

同样适合我。

  1. What Kohana version do you use? This example is for 3.3 only.
  2. 你用什么Kohana版本?此示例仅适用于3.3。
  3. Your route must be defined before default route.
  4. 必须在默认路由之前定义您的路由。

#1


1  

The same works for me.

同样适合我。

  1. What Kohana version do you use? This example is for 3.3 only.
  2. 你用什么Kohana版本?此示例仅适用于3.3。
  3. Your route must be defined before default route.
  4. 必须在默认路由之前定义您的路由。