Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //exemple d'appel
- Database::getInstance();
- class Database {
- private static $instance;
- private $pdo;
- private $host;
- private $dbName;
- private $userName;
- private $password;
- public function __construct($host, $dbName, $userName, $password) {
- $this->host = $host;
- $this->dbName = $dbName;
- $this->userName = $userName;
- $this->password = $password;
- }
- public static function getInstance() {
- if(static::$instance == null) {
- static::$instance = new Database($host, $dbName, $userName, $password);
- }
- return static::$instance;
- }
- }
Add Comment
Please, Sign In to add comment