关于php框架Zend framework的url问题
发布网友
发布时间:2022-04-30 14:28
我来回答
共1个回答
热心网友
时间:2022-06-23 03:33
mole.config.php可以配置访问规则,当配置为如下规则时
<?php
return array(
'controllers' => array(
'invokables' => array(
'Album\Controller\Album' => 'Album\Controller\AlbumController',
),
),
// The following section is new and should be added to your file
'router' => array(
'routes' => array(
'album' => array(
'type' => 'segment',
'options' => array(
'route' => '/album[/:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Album\Controller\Album',
'action' => 'index',
),
),
),
),
),
'view_manager' => array(
'template_path_stack' => array(
'album' => __DIR__ . '/../view',
),
),
);
可以使用/album访问到 album控制器下面的AlbumContreller 的index方法