Database.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace Core;
  3. /**
  4. * 单利模式
  5. * Class Database
  6. * @package Core
  7. */
  8. class Database{
  9. /**
  10. * 单例模式
  11. * @var
  12. */
  13. protected static $db = null;
  14. /**
  15. * 私有化
  16. */
  17. private function __construct(){
  18. }
  19. /**
  20. * 私有化
  21. */
  22. private function __clone(){
  23. }
  24. /**
  25. * 私有化
  26. * 当在类外部使用unserialize()时会调用这里的__wakeup()方法
  27. */
  28. private function __wakeup(){
  29. }
  30. /**
  31. * 获取实例
  32. */
  33. static function getInstance(){
  34. if(is_null(self::$db)){
  35. self::$db = new self();
  36. }
  37. return self::$db;
  38. }
  39. /**
  40. * @param $where
  41. * @return $this
  42. */
  43. public function where($where){
  44. return $this;
  45. }
  46. /**
  47. * @param $order
  48. * @return $this
  49. */
  50. public function order($order){
  51. return $this;
  52. }
  53. /**
  54. * @param $limit
  55. * @return $this
  56. */
  57. public function limit($limit){
  58. return $this;
  59. }
  60. }