1

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

我试图为 zfcuser 设置“/”路由,但它不起作用(bjyauthorizestrategy 发送异常)。我怎么能路由 zfcuser 孩子得到我正在寻找的东西?

4

1 回答 1

3

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

完整答案:现在我在 module.config.php 中的代码如下所示:

    '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',
            ),
        ),                        
    ),

我也想使用自定义模板登录/注册等,所以我把这个:

'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 !!!
    ),

我希望它会有所帮助;)

于 2013-04-19T08:28:52.237 回答