Raw.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: liu21st <liu21st@gmail.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace think\db;
  13. /**
  14. * SQL Raw
  15. */
  16. class Raw
  17. {
  18. /**
  19. * 查询表达式
  20. *
  21. * @var string
  22. */
  23. protected $value;
  24. /**
  25. * 创建一个查询表达式
  26. *
  27. * @param string $value
  28. * @return void
  29. */
  30. public function __construct(string $value)
  31. {
  32. $this->value = $value;
  33. }
  34. /**
  35. * 获取表达式
  36. *
  37. * @return string
  38. */
  39. public function getValue(): string
  40. {
  41. return $this->value;
  42. }
  43. public function __toString()
  44. {
  45. return (string) $this->value;
  46. }
  47. }