コード例 #1
0
 public static function getRouters()
 {
     static $routers = array();
     if (empty($routers)) {
         foreach (glob(Config::getBasePath() . '/routers/*.php') as $routerFile) {
             $name = basename($routerFile, '.php');
             $routers[] = Lib::router($name);
         }
     }
     return $routers;
 }
コード例 #2
0
ファイル: lib.php プロジェクト: jasonrey/lab-page
 public static function url($target, $options = array(), $external = false)
 {
     $values = array();
     $router = Config::$sef ? Lib::router($target) : false;
     $base = $external ? Config::getBaseUrl() . '/' . Config::getBaseFolder() . '/' : '';
     if (!$router) {
         foreach ($options as $k => $v) {
             $values[] = $k . '=' . $v;
         }
         $queries = implode('&', $values);
         if (!empty($queries)) {
             $queries = '?' . $queries;
         }
         return $base . $target . '.php' . $queries;
     }
     $link = $base . $router->build($options);
     return $link;
 }