1

我不明白为什么

class test {
 
    
    function __destruct() {
        echo "I am the destructor<br>";
    }
    
    function __construct() {
         $this->a=debug_backtrace(); # <=== THIS LINE
    }
}
$myclass=new test();
unset($myclass);
echo "Last Line<br>";

out- 和 incommenting 这一行会改变 echo 输出的顺序。当构造函数之前执行 debug_backtrace() 时,为什么 unset() 不调用析构函数?

4

0 回答 0