Пример #1
0
 protected function connect()
 {
     $db = new \swoole_mysql();
     $db->on('close', function ($db) {
         $this->remove($db);
     });
     return $db->connect($this->config, function ($db, $result) {
         if ($result) {
             $this->join($db);
         } else {
             $this->failure();
             trigger_error("connect to mysql server[{$this->config['host']}:{$this->config['port']}] failed. Error: {$db->connect_error}[{$db->connect_errno}].");
         }
     });
 }