时间:2021-07-01 10:21:17 帮助过:37人阅读
#function.php
class test{
private static $_instance = NULL;
public function a(){
echo 'metchod a';
}
public function b(){
echo 'method b';
}
public static function instance(){
if(self::$_instance === NULL){
self::$_instance = new self();
}
return self::$_instance;
}
}
#a.php
//include function.php
echo test::instance()->a();
#b.php
//include function.php
echo test::instance()->b();