【问题标题】:Social Engine 4 User profile reroutingSocial Engine 4 用户配置文件重新路由
【发布时间】:2016-02-29 11:10:09
【问题描述】:

对于使用 Zend 框架的 Social Engine 4。 我想在子域下显示用户配置文件。所以,http://domain.com/profile/username 将是 http://username.domain.com

我该怎么做。我已经有一个扩展名,可以将http://domain.com/profile/username 转换为http://domain.com/username 这是它的代码。

$route = array(
        'user_profile' => array(
            'route' => ':id/*',
            'defaults' => array(
                'module' => 'user',
                'controller' => 'profile',
                'action' => 'index'
            ),
            'reqs' => array(
                'id' => "\b.+"
            )
        )
    );
Zend_Registry::get('Zend_Controller_Front')->getRouter()->addConfig(new Zend_Config($route));

是否可以将其更改为适用于子域?如果是,我该怎么做?

提前谢谢你。

【问题讨论】:

    标签: php zend-framework zend-framework2 regex-negation socialengine


    【解决方案1】:
            $hostnameRoute = new Zend_Controller_Router_Route_Hostname(
                                                ':id.'.$setting['siteurl'],
                                                        array(
                                                            'module' => 'user',
                                                            'controller' => 'profile',
                                                            'action' => 'index',
                                                        )
                                                    );
            $plainPathRoute = new Zend_Controller_Router_Route_Static('');
            $router->addRoute('user_profile', $hostnameRoute->chain($plainPathRoute));
    

    【讨论】:

      猜你喜欢
      • 2017-09-26
      • 2011-06-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-08
      • 1970-01-01
      相关资源
      最近更新 更多