-1
class mysql{

    function __construct(){
        $this->connect();
    }

    function __destruct(){
        $mysqli = $this->connect();
        $mysqli->close();
    }

    public function connect(){

        static $mysqli;

        require_once(ROOT_PATH.'/config/db_conf.php');

        @$mysqli = new mysqli($sql_login['host'], $sql_login['user'], $sql_login['password'] , $sql_login['database'], $sql_login['port']);

        if(!$mysqli){
            throw new Exception("Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error);
        }

        return $mysqli;
    }
}

mysqlに接続しようとすると、すべて問題ありませんが、その後警告が表示されます:mysqli::close(): Couldn't fetch mysqli in...

4

1 に答える 1