Instance.php 401 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2019/5/22
  6. * Time: 15:24
  7. */
  8. namespace app\pplus;
  9. trait Instance
  10. {
  11. private static $Instance = null;
  12. public static function getInstance($cache = true)
  13. {
  14. if ($cache && self::$Instance) {
  15. return self::$Instance;
  16. }
  17. self::$Instance = new self();
  18. return self::$Instance;
  19. }
  20. }