Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Core
- {
- public $dbh; // database connection handle
- private static $dsn = 'mysql:hostname=;dbname=dbname';
- private static $user = 'user';
- private static $pass = 'pass';
- private static $instance;
- public function __construct () {
- $this->dbh = new PDO(self::$dsn,self::$user,self::$pass);
- }
- public static function getInstance(){
- if(!isset(self::$instance)){
- $object= __CLASS__;
- self::$instance=new $object;
- }
- return self::$instance;
- }
- }
Add Comment
Please, Sign In to add comment