onStart() 공개 메소드

public onStart ( $serv, $worker_id )
예제 #1
0
 function onStart($serv)
 {
     parent::onStart($serv);
     if (empty($this->apps_path)) {
         if (!empty($this->config['apps']['apps_path'])) {
             $this->apps_path = $this->config['apps']['apps_path'];
         } else {
             throw new AppServerException("AppServer require apps_path");
         }
     }
     $php = Swoole::getInstance();
     $php->addHook(Swoole::HOOK_CLEAN, function () {
         $php = Swoole::getInstance();
         //模板初始化
         if (!empty($php->tpl)) {
             $php->tpl->clear_all_assign();
         }
         //还原session
         if (!empty($php->session)) {
             $php->session->open = false;
             $php->session->readonly = false;
         }
     });
 }