You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
477 B
33 lines
477 B
<?php |
|
|
|
/** |
|
* 弄成单例模式 |
|
*/ |
|
namespace App\Services; |
|
|
|
|
|
class BaseServices |
|
{ |
|
protected static $instance; |
|
|
|
/** |
|
* @return static |
|
*/ |
|
public static function getInstance() |
|
{ |
|
if(static::$instance instanceof static){ |
|
return static::$instance; |
|
} |
|
|
|
static::$instance = new static(); |
|
return static::$instance; |
|
} |
|
|
|
private function __construct() |
|
{ |
|
} |
|
|
|
private function __clone() |
|
{ |
|
} |
|
}
|
|
|