正在显示
1 个修改的文件
包含
8 行增加
和
0 行删除
| @@ -38,6 +38,14 @@ class DbPool { | @@ -38,6 +38,14 @@ class DbPool { | ||
| 38 | if(!$this->client){ | 38 | if(!$this->client){ |
| 39 | $this->connect(); | 39 | $this->connect(); |
| 40 | } | 40 | } |
| 41 | + | ||
| 42 | + try { | ||
| 43 | + // 判断是否链接中 | ||
| 44 | + $this->client->getAttribute(\PDO::ATTR_SERVER_INFO); | ||
| 45 | + }catch (\Throwable $e){ | ||
| 46 | + $this->connect(); | ||
| 47 | + } | ||
| 48 | + | ||
| 41 | $this->lastTimer = time(); | 49 | $this->lastTimer = time(); |
| 42 | return $this->client; | 50 | return $this->client; |
| 43 | } | 51 | } |
-
请 注册 或 登录 后发表评论