Zend Framework 2 - Multiple modules by URL

前端 未结 3 791
谎友^
谎友^ 2020-12-30 18:09

I\'m currently using the ZendFrameworkSkeleton application from Git and am trying to utilize the module part of it to have a multitude of modules, changeable by URL like so:

3条回答
  •  一向
    一向 (楼主)
    2020-12-30 18:15

    To change routing you need to edit Application/confid/module.config.php. Find there and change to

    'options' => array(
        'route' => '/[:module/[:controller[/:action]]]', 
        'constraints' => array(
            'module' => '[a-zA-Z][a-zA-Z0-9_-]*', 
            'controller' => '[a-zA-Z][a-zA-Z0-9_-]*', 
            'action' => '[a-zA-Z][a-zA-Z0-9_-]*'
        ), 
        'defaults' => array(
            'module' => 'Application', 
            'controller' => 'index', 
            'action' => 'index'
        )
    )
    

    You can see I added /[:module and deafults and constraint

提交回复
热议问题