Beispiel #1
0
 public function __construct($path)
 {
     Y::has('defaultMoude') && (self::$module = Y::get('defaultModule'));
     Y::has('defaultController') && (self::$control = Y::get('defaultController'));
     Y::has('defaultAction') && (self::$action = Y::get('defaultAction'));
     $this->parseRoute($path);
 }
 /**
  * 初始化路由
  * @return [type]     [description]
  */
 public function initRoute()
 {
     $isCli = Y::isCli();
     if ($isCli) {
         $router = new cliRoute();
     } else {
         $router = new webRoute();
     }
     $router->dispatch();
 }
Beispiel #3
0
 public static function run()
 {
     // self::parseConfig();
     if (Y::isCli()) {
         // cli 模式
     } else {
         // web模式
     }
     // Route::dispach();
 }
Beispiel #4
0
 public function getTemplateFile($template = '')
 {
     $file = Y::getControl();
     if ($template) {
         if (strpos($template, 'Views') != false) {
             return $template;
         }
         $file .= $template;
     } else {
         $file .= Y::getAction();
     }
     return $this->path . $file . '.' . Y::get('ext');
 }
 public static function get($name, $default = NULL)
 {
     $value = NULL;
     if (array_key_exists($name, Y::getParams())) {
         $value = Y::getParams($name);
     } else {
         $params = $_GET;
         if (array_key_exists($name, $params)) {
             $value = $params[$name];
         }
     }
     if (!self::validate('get_' . $name, $value) || is_null($value)) {
         $value = $default;
     }
     return $value;
 }
Beispiel #6
0
 /**
  * 获取数据库连接实例
  * @author jixm 
  * @date   2015-10-19
  * @param  [type]     $name mysql配置项名
  * @param  [type]     $type 类型mysql,pdo 或者mysqli
  * @return [type]           [description]
  */
 public static function getInstance($name, $type)
 {
     $dbConfig = Y::get($type . '_' . $name);
     return F::getInstance('Db\\' . $type, $dbConfig);
 }
Beispiel #7
0
 public function init()
 {
     Y::enableView();
     $this->setViewPath(VIEW);
 }
Beispiel #8
0
 public function LoginAction()
 {
     Y::dump(111111111111.0);
     $id = R::post('id');
     var_dump($id);
 }
 public function onError()
 {
     Y::dump("***************************onError****************************");
 }
 public function __destruct()
 {
     if (Y::getParams('debug') && Y::getParams('debug') == 'safe') {
         //开启xhprof
         Debug::disable();
     }
 }