首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >是否禁用默认zfcUser路由?

是否禁用默认zfcUser路由?
EN

Stack Overflow用户
提问于 2013-03-19 16:40:24
回答 1查看 1.4K关注 0票数 2

我正在使用zfcUser,我想知道是否可以禁用默认路由,例如zfcUser/loginzfcUser/register等,因为我不想暴露它们。

我看了看zfcuser.global.php,但似乎没有这样的选项?

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-03-19 16:59:02

您可以通过设置空控制器或不匹配的路由配置来简单地覆盖配置。

解决方案1:覆盖可调用的zfcuser控制器:

代码语言:javascript
复制
// YourApp\Module#getConfig() or config/autoload/zfcuser.override.global.php

return array(
    'controllers' => array(
        'invokables' => array(
            'zfcuser' => null,
        ),
    ),
);

解决方案2:使用您自己的路由配置覆盖路由配置(hacky,不鼓励):

代码语言:javascript
复制
// YourApp\Module#getConfig() or config/autoload/zfcuser.override.global.php

return array(
    'router' => array(
        'routes' => array(
            'zfcuser' => array(
                // changing to hostname route - using an unreachable hostname
                'type' => 'Hostname',
                // minimum possible priority - all other routes come first.
                'priority' => ~PHP_INT_MAX,
                'options' => array(
                    // foo.bar does not exist - never matched
                    'route' => 'foo.bar',
                    'defaults' => array(
                        'controller' => null,
                        'action' => 'index',
                    ),
                ),

                // optional - just if you want to override single child routes:
                'child_routes' => array(
                    'login' => array(
                        'options' => array(
                            'defaults' => array(
                                'controller' => null,
                            ),
                        ),
                    ),
                    'authenticate' => array(
                        'options' => array(
                            'defaults' => array(
                                'controller' => null,
                            ),
                        ),
                    ),
                    'logout' => array(
                        'options' => array(
                            'defaults' => array(
                                'controller' => null,
                            ),
                        ),
                    ),
                    'register' => array(
                        'options' => array(
                            'defaults' => array(
                                'controller' => null,
                            ),
                        ),
                    ),
                    'changepassword' => array(
                        'options' => array(
                            'defaults' => array(
                                'controller' => null,
                            ),
                        ),
                    ),
                    'changeemail' => array(
                        'options' => array(
                            'defaults' => array(
                                'controller' => null,
                            ),
                        ),
                    ),
                ),
            ),
        ),
    ),
);
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15494787

复制
相关文章

相似问题

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