首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用/abc/abc/abc php呈现标题

使用/abc/abc/abc php呈现标题
EN

Stack Overflow用户
提问于 2014-03-24 08:05:58
回答 1查看 59关注 0票数 0

我有使用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/照片这一部分

EN

回答 1

Stack Overflow用户

发布于 2014-03-24 13:10:37

在您的module/Module Name/config/module.config.php中,您可以设置路由。

代码语言:javascript
复制
'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',
                ),
            ),
        ),
    ),
),

就像这样

代码语言:javascript
复制
'route'    => '/profile/[/:id]/photos',

参考http://framework.zend.com/manual/2.0/en/user-guide/routing-and-controllers.html

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22598886

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档