已經(jīng)在 config/bootstrap.php 中加了 support\bootstrap\db\Heartbeat::class
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://wtbis.cn/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
return [
support\bootstrap\Container::class,
support\bootstrap\Session::class,
support\bootstrap\db\Laravel::class,
support\bootstrap\Redis::class,
support\bootstrap\Log::class,
support\bootstrap\Translation::class,
support\bootstrap\db\Heartbeat::class
];
default.ERROR: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away {"exception":"PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in
看源碼心跳默認是主連接定時發(fā)了心跳。如果你用了多個數(shù)據(jù)庫連接,需要改下support\bootstrap\db\Heartbeat類,讓每個連接都發(fā)送心跳。