我有两节课:
class Init {
public function test() {
echo 1;
}
public static function loadSecond() {
// Load the class
}
}
class Second extends Init {
public function test2() {
echo 2;
}
}
我只需要按请求加载Second
类。例如:
$init = new Init();
$init->test();
$second = $init::loadSecond();
$second->test2();