Last active
September 28, 2017 11:48
-
-
Save codingfox-rus/1d8ba6c81a3fd8a3348385eb42e186ae to your computer and use it in GitHub Desktop.
Образец соединения через PDO
This file contains hidden or 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
<?php | |
$host = ''; | |
$db = ''; | |
$user = ''; | |
$pass = ''; | |
$charset = 'utf8'; | |
$dsn = "mysql:host=$host;dbname=$db;charset=$charset"; | |
$opt = [ | |
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, | |
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, | |
PDO::ATTR_EMULATE_PREPARES => false, | |
]; | |
$pdo = new PDO($dsn, $user, $pass, $opt); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment