Wednesday, March 28, 2012

Singleton


require_once 'lib/MySQL.php';

/**
* Singleton
*/
class DB {
public static $conn = null;
/**
*
* @return type MQSQL connection
*/
public static function connect()
{
if (self::$conn == null) {
self::$conn = new MySQL();
}
return self::$conn;
}
}

No comments:

Post a Comment