我有使用php的经验,但我是zend框架的新手。有人能给我一些关于如何让一个网站工作的线索吗-- www.facebook.com/nathandoe/photos。如何使用控制器创建一个接受不同名称的函数并将其定向到该页面?
如果我有一个网站www.hello.com/profile
而不是使用GET www.hello.com/profile?is=342342?photos
如何将其作为www.hello.com/profile/342342/photos进行处理
我有处理索引的控制器,我知道如何创建不同的函数。我坚持使用www.hello.com/profile/xxxxxxxx/照片这一部分
发布于 2014-03-24 13:10:37
在您的module/Module Name/config/module.config.php中,您可以设置路由。
'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',
),
),
),
),
),就像这样
'route' => '/profile/[/:id]/photos',参考http://framework.zend.com/manual/2.0/en/user-guide/routing-and-controllers.html
https://stackoverflow.com/questions/22598886
复制相似问题