zend framework router
2009-09-11 3:36 pmzend framework 的 router很强大,今天用了一下觉得挺不错了,主要对SEO有很大的帮助,
拿上来分享一下:
在boostrap里面加载router,如:
protected function _initRouter()
{
$ctrl = Zend_Controller_Front::getInstance();
$router = $ctrl->getRouter();
$route = new Zend_Controller_Router_Route(
'ranking/:date',
array('module' => 'default',
'controller' => 'interface',
'action' => 'ranking',
)
);
$router->addRoute('ranking', $route);
}
在控制器里面直接$this->_getParam('date', NULL);就可以了,上面只是一个测试,没有实际的意义。
在seo中规范路径,用html格式等会给用户或者spider都带来很好的帮助。

