Zend framework 如何在Zend框架中重写域

Zend framework 如何在Zend框架中重写域,zend-framework,Zend Framework,我正在写一份用户登记表。 在用户使用用户名注册后,例如“Billy”,我希望他使用url Billy.mydomain.com访问服务器 billy.mydomain.com的Zend框架链接是 www.mydomain.com/profile/index/username/billy 我想知道如何从 www.mydomain.com/profile/index/username/billy 到 billy.mydomain.com扔掉我最初的答案,会更加优雅 $hostnameRoute =

我正在写一份用户登记表。
在用户使用用户名注册后,例如“Billy”,我希望他使用url Billy.mydomain.com访问服务器

billy.mydomain.com的Zend框架链接是
www.mydomain.com/profile/index/username/billy

我想知道如何从
www.mydomain.com/profile/index/username/billy


billy.mydomain.com

扔掉我最初的答案,会更加优雅

$hostnameRoute = new Zend_Controller_Router_Route_Hostname(
    ':username.mydomain.com',
    array(
        'controller' => 'profile',
    )
);

$pathRoute = new Zend_Controller_Router_Route(":action/*", array( 'action'=>'index' ));
$chain = $hostnameRoute->chain($pathRoute);

// add $chain to your router

扔掉我最初的答案,会更加优雅

$hostnameRoute = new Zend_Controller_Router_Route_Hostname(
    ':username.mydomain.com',
    array(
        'controller' => 'profile',
    )
);

$pathRoute = new Zend_Controller_Router_Route(":action/*", array( 'action'=>'index' ));
$chain = $hostnameRoute->chain($pathRoute);

// add $chain to your router