Kohana 3.3使用Windows上的子文件夹进行路由,但在Linux上失败

时间:2018-07-31 09:15:08

标签: kohana-3.3

我使用kohana 3.3(as per this answer)并添加了以下控制器:

applications/classes/Controller/Myfolder/Subfolder1
applications/classes/Controller/Myfolder/Subfolder2
applications/classes/Controller/Myfolder/Subfolder3

每个文件夹都包含几个控制器:

applications/classes/Controller/Myfolder/Subfolder1/Mycontroller1.php
applications/classes/Controller/Myfolder/Subfolder1/Mycontroller2.php
applications/classes/Controller/Myfolder/Subfolder1/Mycontroller3.php

在Windows中,此路由工作正常,但在Linux上则不起作用,并显示404:

Route::set('mycontroller', '<directory>/<controller>/<action>', array(
    'directory' => 'myfolder/subfolder1|myfolder/subfolder2|myfolder/subfolder3',
));

我必须为每个控制器创建一条路由,例如:

Route::set('myfolder/subfolder1', 'myfolder/subfolder1/<controller>/<action>')
->defaults(array(
    'directory' => 'Myfolder/Subfolder1',
));
Route::set('myfolder/subfolder2', 'myfolder/subfolder2/<controller>/<action>')
->defaults(array(
    'directory' => 'Myfolder/Subfolder2',
));

我在Linux上犯了什么错误?不,这无助于大写(在Windows和Linux上不起作用,它必须是小写):

Route::set('mycontroller', '<directory>/<controller>/<action>', array(
    'directory' => 'Myfolder/Subfolder1|Myfolder/Subfolder2|Myfolder/Subfolder3',
));

1 个答案:

答案 0 :(得分:0)

Linux是区分大小写的文件系统。

<direcotry>不应包含/。尝试使用Cascading Filesystemmyfolder_subfolder1route filters来更改direcotry的大小写