示例#1
0
文件: ant.php 项目: nirix-old/ant
 /**
  * Builds the routes then processes the request to the controller and method.
  * @param array $config The config array with the controller path and routes.
  */
 public static function init(array $config)
 {
     static::$controller_path = $config['controller_path'];
     foreach ($config['routes'] as $route => $args) {
         if (!is_array($args)) {
             $args = array($args, 'params' => array());
         }
         static::$routes[$route] = $args;
     }
     static::$request = static::get_request();
     static::route();
 }
示例#2
0
文件: Anchor.php 项目: imarc/anchor
 public static function setControllerPath($path)
 {
     static::$controller_path = realpath($path);
 }
示例#3
0
        /**
         * Start routing process.
         * 
         * @return void
         */

	public static function go()
	{
                // Define controllers root path.
            	static::$controller_path = ROOT . '/controllers';
                
                // Get segments of url.
		static::segments();
                
                // Check if exists subpath in controllers path.
		static::path_exists();
                
                // Instance controller.
		static::controller();
                
                // Define action for call.
		static::action(); 

		$controller = static::$controller;
		$action = static::$action;
		$controller->$action();
	}