2009-06-21 83 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