我正在使用主机名路由来捕获子域并用作类别。然后,我为控制器、操作和键/值对链接路由器路由。
$hostnameRoute = new Zend_Controller_Router_Route_Hostname(
':customer.ddc.:domain',
array(
'customer' => ':customer'
)
);
$routerRoute = new Zend_Controller_Router_Route(
':controller/:action/*',
array(
'controller' => 'index',
'action' => 'index'
)
);
$chainedRoute = $hostnameRoute->chain($routerRoute);
$frontController->getRouter()->addRoute('default',$chainedRoute);
我可以捕获除 URI 上的键/值对之外的所有内容。添加它们会导致请求中的 Params 对象不会被填充。
这有效: http ://category.mydomain.com/controller/action/
这不是:http ://category.mydomain.com/controller/action/username/frank
感谢您的任何建议。