相关疑难解决方法(0)

ZF2:在控制器中获取url参数

我已经体验过Zend Framework 1,并且我已经使用该框架构建了一些应用程序.

现在,我正在试验Zend Framework 2,但我坚持使用url参数.我设置了这样的路由:

// Setup for router and routes
'Zend\Mvc\Router\RouteStack' => array(
    'parameters' => array(
        'routes' => array(
            'default' => array(
                'type'    => 'Zend\Mvc\Router\Http\Segment',
                'options' => array(
                    'route'    => '/[:slug]',
                    'constraints' => array(
                    'slug' => '[a-zA-Z][a-zA-Z0-9_\/-]*'
                    ),
                'defaults' => array(
                    'controller' => 'Htmlsite\Controller\BootController',
                    'action'     => 'index',
                    'slug' => 'home'
                    ),
                ),
            ),
        'home' => array(
            'type' => 'Zend\Mvc\Router\Http\Literal',
            'options' => array(
                'route'    => '/',
                'defaults' => array(
                    'controller' => 'Htmlsite\Controller\BootController',
                    'action'     => 'index',
                    ),
                ),
            ),
        ), …
Run Code Online (Sandbox Code Playgroud)

php zend-framework-mvc zend-framework2

25
推荐指数
4
解决办法
6万
查看次数

标签 统计

php ×1

zend-framework-mvc ×1

zend-framework2 ×1