1234567891011121314151617181920212223 |
- <?php
-
- /**
- * Created by PhpStorm.
- * User: guanxl
- * Date: 2018/3/22
- * Time: 19:57
- */
- namespace App\Common;
-
-
- trait Singleton
- {
- private static $instance;
-
- static function getInstance(...$args)
- {
- if(!isset(self::$instance)){
- self::$instance = new static(...$args);
- }
- return self::$instance;
- }
- }
|