1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
<?php
define ("DB_DNS", "xxxx;dbname=xxxx");
class mysql extends PDO {
private static $_instance;
/* Constructeur : h�ritage public obligatoire par h�ritage de PDO */
public function __construct( ) {
}
// End of PDO2::__construct() */
/* Singleton */
public static function getInstance() {
if (!isset(self::$_instance)) {
try {
self::$_instance = new PDO(DB_DNS, 'xxxx', 'xxxx');
} catch (PDOException $e) {
echo $e;
}
}
return self::$_instance;
}
// End of PDO2::getInstance() */
}
?> |
Partager