Created
October 11, 2017 07:56
-
-
Save seriiserii825/2ddb6211ed8194b760a11398bb1fa040 to your computer and use it in GitHub Desktop.
pdo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$option = [ | |
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, | |
\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC, | |
\PDO::ATTR_EMULATE_PREPARES => false | |
]; | |
try{ | |
$this->dbh = new \PDO('mysql:host=127.0.0.1;dbname=stepantev', 'root', 'root', $option); | |
$this->dbh->exec('set charset UTF8'); | |
} | |
catch (\PDOException $e){ | |
throw new \App\Exceptions\Db($e->getMessage()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment