class Single{

    private static $_instance;//必须静态属性 static

    private function __construct(){

    }

    public function __clone(){//__clone 带下划线,不是clone
        trigger_error("Clone is not allow",E_USER_ERROR);
    }

    public static function getInstance(){//必须静态方法 static
        if(!(self::$_instance instanceof self)){
            self::$_instance = new self;
        }
        return self::$_instance;
    }

    public function test(){
        echo "I am test";
    }
}

$single = Single::getInstance();//先生成实例
$single->test();