首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ZfcUser替换路由

ZfcUser替换路由
EN

Stack Overflow用户
提问于 2013-04-18 20:35:11
回答 1查看 2.5K关注 0票数 1

我正在尝试将zfcuser路由作为我的模块的根。我的意思是我尝试删除"/user/login?...“并将其替换为"/login?...“下面是重命名根目录的方法:http://juriansluiman.nl/en/article/117/use-3rd-party-modules-in-zend-framework-2

我尝试为zfcuser设置"/“路由,但不起作用(bjyauthorizestrategy发送异常)。我如何路由zfcuser子节点来获得我正在寻找的东西?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-04-19 16:28:52

答案的一部分:https://github.com/ZF-Commons/ZfcUser/issues/202

完整的答案:现在我的module.config.php代码看起来像这样:

代码语言:javascript
复制
    'zfcuser' => array(
            'type' => 'Zend\Mvc\Router\Http\Literal',
            'options' => array(
                'route' => '', // the route is void isntead of default 'user'
            ),
    ),
    'zfcuser-login' => array(
        'type' => 'Literal',
        'options' => array(
            'route' => '/login',
            'defaults' => array(
                'controller' => 'zfcuser',
                'action' => 'login',
            ),
        ),
    ),
    'zfcuser-authenticate' => array(
        'type' => 'Literal',
        'options' => array(
            'route' => '/authenticate',
            'defaults' => array(
                'controller' => 'zfcuser',
                'action' => 'authenticate',
            ),
        ),
    ),
    'zfcuser-logout' => array(
        'type' => 'Literal',
        'options' => array(
            'route' => '/logout',
            'defaults' => array(
                'controller' => 'zfcuser',
                'action'     => 'logout',
            ),
        ),
    ),
    'zfcuser-register' => array(
        'type' => 'Literal',
        'options' => array(
            'route' => '/register',
            'defaults' => array(
                'controller' => 'zfcuser',
                'action'     => 'register',
            ),
        ),
    ),
    'zfcuser-changepassword' => array(
        'type' => 'Literal',
        'options' => array(
            'route' => '/change-password',
            'defaults' => array(
                'controller' => 'zfcuser',
                'action'     => 'changepassword',
            ),
        ),                        
    ),
    'zfcuser-changeemail' => array(
        'type' => 'Literal',
        'options' => array(
            'route' => '/change-email',
            'defaults' => array(
                'controller' => 'zfcuser',
                'action' => 'changeemail',
            ),
        ),                        
    ),

我还想使用自定义模板进行登录/注册等,所以我放了这个:

代码语言:javascript
复制
'view_manager' => array( 
    ...
    'template_path_stack' => array(
          // to load our module view
          'YOURMODULENAME'  => __DIR__ . '/../view', // zfcuser have to load after 
          your module in your application.config.php !!!
    ),

我希望这对我们有所帮助。)

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

https://stackoverflow.com/questions/16083142

复制
相关文章

相似问题

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