-1

我有一个包含此功能的购物车库。从文档中可以看出: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);
}
4

1 回答 1

3

__destruct不是__deconstruct

http://php.net/manual/en/language.oop5.decon.php

于 2013-01-04T18:34:08.937 回答