【发布时间】:2016-07-01 22:16:30
【问题描述】:
我有一个基于 Zend Framework 2.3 的小型站点,它在带有 OS X Server 的 OS X 上运行。我需要做一些开发,所以我把它复制到了 Debian 7 系统上。除了数据库定义之外,两台机器上的代码都是相同的。基于 Linux 的系统适用于大多数功能,但其中一个会导致 404 错误,我不明白为什么会这样。 module.config.php 是 大批 ( 'invokables' => 数组 ( 'LibraryRest\Controller\AuthorRest' => 'LibraryRest\Controller\AuthorRestController', 'LibraryRest\Controller\BookTitleRest' => 'LibraryRest\Controller\BookTitleRestController', 'LibraryRest\Controller\RecentRest' => 'LibraryRest\Controller\RecentRestController' ), '工厂' => 数组 ( 'LibraryRest\Controller\SearchRest' => 'LibraryRest\Factory\SearchRestControllerFactory' ) ), '路由器' => 数组 ( '路线' => 数组 (
'author-rest' => array (
'type' => 'Segment',
'options' => array (
// Change this to something specific to your module
'route' => '/author-rest[/:id]',
'constraints' => array (
'id' => '[0-9]+'
),
'defaults' => array (
'controller' => 'LibraryRest\Controller\AuthorRest'
)
)
)
,
'booktitle-rest' => array (
'type' => 'Segment',
'options' => array (
'route' => '/booktitle-rest[/:id]',
'constraints' => array (
'id' => '[0-9]+'
),
'defaults' => array (
'controller' => 'LibraryRest\Controller\BookTitleRest'
)
)
),
'recent-rest' => array (
'type' => 'Segment',
'options' => array (
'route' => '/recent-rest',
'defaults' => array (
'controller' => 'LibraryRest\Controller\RecentRest'
)
)
),
'search-rest' => array (
'type' => 'Segment',
'options' => array (
'route' => '/search-rest[/:action[/:first][/:last]]',
'constraints' => array (
'first' => '[a-zA-Z0-9_-\s\x40%\.]*',
'last' => '[a-zA-Z0-9_-\s\x40%]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*'
),
'defaults' => array (
'controller' => 'LibraryRest\Controller\SearchRest'
)
)
)
)
),
'view_manager' => array (
'strategies' => array (
'ViewJsonStrategy'
)
)
); 在 linux 机器上失败的路由是 search-rest,所以http://mysite/search-rest/search/John/Smith 会导致 404。此模块中的所有其他路由在两个系统上都能正常工作。
什么可能导致 Linux 系统上的路由失败?
【问题讨论】:
-
可能是区分大小写的问题。检查 SearchRest 控制器的文件名。
标签: linux macos zend-framework2 debian