I don't understand the meaning of judging whether it is a static instance? ?
God_Like
God_Like 2019-05-16 12:43:53
0
1
1392

One ($instance =null;) has been defined above

Judgment (self::$instance instanceof self) is definitely (false)

Why do we still need to judge?

Isn’t it enough to directly assign the current object instance to (self::$instance) and then return the value?

self::$instance =new self($sitename);
return self::$instance;


God_Like
God_Like

reply all(1)
智障少女欢乐多

That’s why we need the singleton mode. If we assign values ​​repeatedly, it will become multiple instances

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template