blog-app/core/database/Connection.php

21 lines
437 B
PHP
Raw Permalink Normal View History

2021-09-16 20:27:51 +08:00
<?php
namespace Core\Database;
class Connection
{
public static function make($config)
{
try {
return new \PDO(
"{$config['connection']};dbname={$config['name']};charset=utf8",
$config['username'],
$config['password'],
$config['options']
);
} catch (\PDOException $e) {
die($e->getMessage());
}
}
}