2009-06-21 81 views
0

我在写用户注册表单。
在用户向用户注册例如“比利”,我想让他使用网址billy.mydomain.com来访问服务器。如何在Zend Framework中重写域

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

我想知道我可以从
WWW重写的URL。 mydomain.com/profile/index/username/billy

billy.mydomain.com

回答

3

扔掉我的初步答案,This Solution是更优雅。

$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