【发布时间】:2012-04-05 08:14:27
【问题描述】:
我体验过 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',
),
),
),
),
),
),
如您所见,我已尝试制作变量 slug。 如何访问此变量?
【问题讨论】:
-
用于存档目的:非常完整的答案在这里stackoverflow.com/questions/12077126/…
标签: php zend-framework2 zend-framework-mvc