blog-app/core/database/Connection.php
2021-11-13 14:19:55 +08:00

21 lines
437 B
PHP

<?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());
}
}
}