From 2c60d4a13bdbdd9b24fe72fb70aceec607a7001d Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 3 May 2017 15:23:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9Bmysql=E9=87=8D=E8=BF=9E?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/connector/Mysql.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/think/db/connector/Mysql.php b/library/think/db/connector/Mysql.php index 0081fb2e..4b6e11a2 100644 --- a/library/think/db/connector/Mysql.php +++ b/library/think/db/connector/Mysql.php @@ -138,8 +138,13 @@ class Mysql extends Connection */ protected function isBreak($e) { - if (false !== stripos($e->getMessage(), 'server has gone away')) { - return true; + $info = ['server has gone away', 'Error while sending STMT_']; + $error = $e->getMessage(); + + foreach ($info as $msg) { + if (false !== stripos($error, $msg)) { + return true; + } } return false; }