Guest User

Untitled

a guest
Apr 18th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1. <?php
  2.  
  3. class Core
  4. {
  5.     public $dbh;   // database connection handle
  6.     private static $dsn  = 'mysql:hostname=;dbname=dbname';
  7.     private static $user = 'user';
  8.     private static $pass = 'pass';
  9.      private static $instance;
  10.  
  11.  
  12.     public function __construct () {
  13.       $this->dbh = new PDO(self::$dsn,self::$user,self::$pass);
  14.     }
  15.  
  16.     public static function getInstance(){
  17.         if(!isset(self::$instance)){
  18.             $object= __CLASS__;
  19.             self::$instance=new $object;
  20.         }
  21.         return self::$instance;
  22.     }
  23.  
  24. }
Add Comment
Please, Sign In to add comment