简单的单例
class A
{
private static $_instance = null;
private function __construct(){}
private function __clone(){}
public static function getInstance()
{
if(! (self::$_instance instanceof self)){
self::$_instance = new self();
}
return self::$_instance;
}
}
$obj = A::getInstance();