示例#1
0
文件: Console.php 项目: janpoem/kephp
 public final function __construct(Argv $argv = null)
 {
     // 绑定当前的默认的上下文环境实例
     if (!isset(self::$context)) {
         self::$context = $this;
     }
     $this->app = App::getApp();
     if (!$this->app->isInit()) {
         $this->app->init();
     }
     $this->app->getLoader()->loadHelper('string');
     $this->writer = new Writer();
     $this->cwd = real_path(getcwd());
     // 将错误和异常处理,从App中接管过来。
     register_shutdown_function(function () {
         $this->onExiting();
     });
     set_error_handler([$this, 'errorHandle']);
     set_exception_handler([$this, 'exceptionHandle']);
     if (isset($argv)) {
         $this->setArgv($argv);
     }
 }
示例#2
0
文件: Web.php 项目: janpoem/kephp
 public function loadHelper(...$helpers)
 {
     $this->app->getLoader()->loadHelper(...$helpers);
     return $this;
 }