Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

yii2 mysql ping

public function ping() {
    try {
        Yii::$app->db->createCommand('SELECT 1')->query();
    } catch (yiidbException $exception) {
        Yii::$app->db->close();
        Yii::$app->db->open();
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #mysql #ping
ADD COMMENT
Topic
Name
4+2 =