名称
Yaf_Router::addRoute
(Since Yaf 1.0.0.5)
public boolean Yaf_Router::addRoute( string
$name ,
Yaf_Route_Interface $route );
给路由器增加一个名为$name的路由协议
例子
例 11.82. Yaf_Router::addRoute
的例子
<?php class Bootstrap extends Yaf_Bootstrap_Abstract{ public function _initRoute(Yaf_Dispatcher $dispatcher) { /** * 添加一个路由 */ $route = new Yaf_Route_Rewrite( "/product/list/:id/", array( "controller" => "product", "action" => "info", ) ); $router->addRoute('dummy', $route); } ?>