1
必要に応じて、パラメータをそのコンストラクタ経由でクラスに渡すことができます。PHP OOP:__destructクラスにパラメータを渡すことは可能ですか?
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
}
}
ありがとう、私はどこでもそれを見つけることができなかった。 – JROB