Is the __destruct method necessary for PHP?
问题 The manual said that The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed or in any order in shutdown sequence. Doesn't the PHP GC enough? Could someone give an example that __destruct method is necessary? 回答1: A destructor has nothing directly to do with releasing memory - instead it is a "hook" to allow custom code to be run when the object is eligible for reclamation. That is, it's the opposite of the