예제 #1
0
 public function index()
 {
     // 实例化视图类
     $view = new \think\View();
     // 渲染模板输出
     return $view->fetch();
 }
예제 #2
0
 public function create()
 {
     // m get
     // 实例化视图类
     $view = new \think\View();
     // 渲染模板输出
     return $view->fetch();
 }
예제 #3
0
 /**
  * 返回封装后的API数据到客户端
  * @access public
  * @param mixed $msg 要返回的数据
  * @param mixed $data 返回的code
  * @param mixed $url 提示信息
  * @param mixed $wait 返回数据格式
  * @return void
  */
 public static function error($msg = '', $data = '', $url = '', $wait = 3)
 {
     $result = ['code' => 0, 'msg' => $msg, 'data' => $data, 'url' => $url ? $url : 'javascript:history.back(-1);', 'wait' => $wait];
     $type = IS_AJAX ? Config::get('default_ajax_return') : Config::get('default_return_type');
     if ('html' == $type) {
         $view = new \think\View();
         $result = $view->fetch(Config::get('dispatch_jump_tmpl'), $result);
     }
     self::returnData($result, $type, true);
 }