我有一个包含此功能的购物车库。从文档中可以看出:PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such as C++. The destructor method will be called as soon as there are no other references to a particular object, or in any order during the shutdown sequence.
我不确定为什么从来没有调用过它。任何人都可以对此有所了解吗?
public function __deconstruct () {
Yii::app()->session->add('cart', $this->order);
}