Zend Framework 2 Segment Route 匹配“test"但不匹配“test/" [英] Zend Framework 2 Segment Route matching 'test' but not 'test/'
本文介绍了Zend Framework 2 Segment Route 匹配“test"但不匹配“test/"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个模块管理和应用程序.在模块应用程序中,我的 module.config.php 中有以下路由:
I have two modules Admin and Application. In the module application I have the following route in my module.config.php:
'admin' => array(
'type' => 'Segment',
'options' => array(
'route' => '/admin[/:controller[/:action]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array (
'__NAMESPACE__' => 'Admin\Controller',
'module' => 'Admin',
'controller' => 'Index',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'wildcard' => array(
'type' => 'Wildcard'
)
)
),
问题在于匹配
example.com/admin
example.com/admin
并且不匹配
example.com/admin/
example.com/admin/
我该如何解决?
推荐答案
Insert [/]
修复它.试试:
Insert [/]
to fix it. try:
'route' => '/admin[/:controller[/:action]][/]',
这篇关于Zend Framework 2 Segment Route 匹配“test"但不匹配“test/"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文