Example #1
0
 /**
  * 构造函数
  * 
  * @param \Ws\Env\App $app
  */
 public function __construct(App $app)
 {
     $this->app = $app;
     $viewDir = $app->config()->get('app.view.dir', false);
     if ($viewDir && is_dir($viewDir)) {
         $viewDir = rtrim($viewDir, '\\/');
     } else {
         $dir = $app->config()->get('app.dir');
         $viewDir = $dir . '/views';
     }
     $this->viewDir = $viewDir;
 }
Example #2
0
 /**
  * 定义命令对象并返回
  * 
  * @param  string   $id 名字
  * 
  * @return \Ws\Mvc\Cmd
  */
 public static function find($id, App $app)
 {
     $id = trim($id);
     if (empty($id)) {
         return null;
     }
     return $app->config()->get('app.cmds/' . strtolower($id));
 }
Example #3
0
 public function cmdView(App $app, $type)
 {
     if ($this->enable) {
         $this->enable = false;
         if ('json' == $type) {
             return $this->getContent();
         }
         if ('ui' == $type) {
             $view = new View(__DIR__ . '/_asdebug', 'ui', ['url' => $app->pagePathing('asdebug'), 'qargs' => $this->qargs]);
             return $view->execute();
         }
     }
     return 422;
 }