让我们采用一个简单的PHP类,其中定义了一些属性,即public / protected或private。 建议的方法与以下方法在功能和效果上的区别。
public function __destruct() {
// unset all properties of this class
foreach ( $this as $key => $value ) {
unset ( $this->$key );
}
}
&
public function __destruct() {
// a blank __destruct method.
}