(Yaf >=1.0.0)
Yaf_Router::addRoute — ��Router������µ�·��
Ĭ�ϵأ�Yaf_Routerʹ��Yaf_Route_Static��Ϊ����Ĭ�ϵ�·�ɡ������ͨ���������������Router�Ķ�ջ�����һ���µ�·��
��·��ջ�У��µ�·�ɹ������ϵĹ����ȵ��ã������·�ɹ���TRUE����ô·�ɽ��̽�������������ϵĹ��ᱻ���á�
��������δ��д�ĵ������в����б�
�˺���û�в�����
Example #1 Yaf_Dispatcher::autoRender()example
<?php
class Bootstrap extends Yaf_Bootstrap_Abstract{
public function _initConfig() {
$config = Yaf_Application::app()->getConfig();
Yaf_Registry::set("config", $config);
}
public function _initRoute(Yaf_Dispatcher $dispatcher) {
$router = $dispatcher->getRouter();
/**
* we can add some pre-defined routes in application.ini
*/
$router->addConfig(Yaf_Registry::get("config")->routes);
/**
* add a Rewrite route, then for a request uri:
* http://***/product/list/22/foo
* will be matched by this route, and result:
*
* [module] =>
* [controller] => product
* [action] => info
* [method] => GET
* [params:protected] => Array
* (
* [id] => 22
* [name] => foo
* )
*
*/
$route = new Yaf_Route_Rewrite(
"/product/list/:id/:name",
array(
"controller" => "product",
"action" => "info",
)
);
$router->addRoute('dummy', $route);
}
?>