Código PHP:
Ver original< ?php
class SPDO extends PDO
{
private static $instance = null;
public function __construct()
{
$dsn = 'mysql:host=' . HOST . ';dbname=' . DATABASE;
parent::__construct($dsn, USER, PASSWORD);
}
public static function singleton()
{
if( self::$instance == null )
{
self::$instance = new self();
}
return self::$instance;
}
}
?>