-1
我有一个包含此功能的购物车库。从documentation它指出: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.
__deconstruct不写会话变量
我不确定为什么这不会被称为。任何人都可以对此有所了解吗?
public function __deconstruct() {
Yii::app()->session->add('cart', $this->order);
}
这应该是'__destruct',不'__deconstruct',所以它非常有意义,它没有被调用。 – netcoder