Yaf 라우팅 프로토콜

 public function _initRoutes(){

    	// Yaf_Route_Supervar 
    	Yaf_Dispatcher::getInstance()->getRouter()->addRoute(
            "supervar",new Yaf_Route_Supervar("r")
    	);
    	// Yaf_Route_Simple 
    	Yaf_Dispatcher::getInstance()->getRouter()->addRoute(
    	"simple",new Yaf_Route_Simple("m", "c", "a"));
    	
    	/**
    	 * Yaf_Route_Supervar 
    	 *  : "http://domain.com/index.php?r=/a/b/c
    	 *  
    	  
    	 array(
    	 'module'     => 'a',
    	 'controller' => 'b',
    	 'action'     => 'c',
    	 )
    	 */
    	
    	/**
    	 * Yaf_Route_Simple 
    	 *  : "http://domain.com/index.php?m=a&c=b&a=c
    	 *  
    	  
    	 array(
    	 'module'     => 'a',
    	 'controller' => 'b',
    	 'action'     => 'c',
    	 )
    	 */

    	/**
    	 * Yaf_Route_Static[ ]
    	 *  : "http://domain.com/index.php/a/b/c
    	 *  
    	  
    	 array(
    	 'module'     => 'a',
    	 'controller' => 'b',
    	 'action'     => 'c',
    	 )
    	 */

    	// 
    	$routes = Yaf_Dispatcher::getInstance()->getRouter()->getRoutes();
    	print_r($routes);
    	/**
    	 *print_r :
    	 Array
    	 (
    	 [_default] => Yaf_Route_Static Object
    	 (
    	 )

    	 [supervar] => Yaf_Route_Supervar Object
    	 (
    	 [_var_name:protected] => r
    	 )

    	 [simple] => Yaf_Route_Simple Object
    	 (
    	 [controller:protected] => c
    	 [module:protected] => m
    	 [action:protected] => a
    	 )
    	 )
    	 */
    }

좋은 웹페이지 즐겨찾기