test.php 864 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace loyalsoft;
  3. include __DIR__ . '/main.php';
  4. //require_once ROOTDIR . '/Util/OpenSSLVerify.php'; # Ps. 这个文件和类名没有对应关系.
  5. //header('X-Accel-Buffering: no'); # nginx 控制头, 关闭buffer
  6. //set_time_limit(15); # 设置执行超时时间
  7. echoLine("phpver:" . PHP_VERSION);
  8. class ABC {
  9. public $age;
  10. public $name = "wg";
  11. static $_ins;
  12. public static function Ins() {
  13. if (null == self::$_ins) {
  14. self::$_ins = new ABC();
  15. }
  16. return self::$_ins;
  17. }
  18. }
  19. $abc = new ABC();
  20. $abc->age = 33;
  21. function Get() {
  22. return ABC::Ins();
  23. }
  24. $ref = Get();
  25. $ref->name = "中国年";
  26. $ref = $abc;
  27. $ref->name = "王刚";
  28. var_dump($ref);
  29. var_dump(ABC::Ins());