-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