【发布时间】:2017-05-14 09:52:09
【问题描述】:
如果需要,可以通过类的构造函数将参数传递给类。
class Test {
public function __construct($echo) {
echo $echo;
}
}
$test = new Test('hello'); // Echos "hello"
有没有办法将参数传递给__destruct?
class Test {
public function __construct($echo) {
echo $echo;
}
public function __destruct($string) { // Is this possible?
// Do something with this string
}
}
【问题讨论】:
标签: php oop destructor