Request.php 6.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006~2018 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. namespace think\facade;
  12. use think\Facade;
  13. /**
  14. * @see \think\Request
  15. * @mixin \think\Request
  16. * @method void hook(mixed $method, mixed $callback = null) static Hook 方法注入
  17. * @method \think\Request create(string $uri, string $method = 'GET', array $params = [], array $cookie = [], array $files = [], array $server = [], string $content = null) static 创建一个URL请求
  18. * @method mixed domain(bool $port = false) static 获取当前包含协议、端口的域名
  19. * @method mixed url(bool $domain = false) static 获取当前完整URL
  20. * @method mixed baseUrl(bool $domain = false) static 获取当前URL
  21. * @method mixed baseFile(bool $domain = false) static 获取当前执行的文件
  22. * @method mixed root(bool $domain = false) static 获取URL访问根地址
  23. * @method string rootUrl() static 获取URL访问根目录
  24. * @method string pathinfo() static 获取当前请求URL的pathinfo信息(含URL后缀)
  25. * @method string path() static 获取当前请求URL的pathinfo信息(不含URL后缀)
  26. * @method string ext() static 当前URL的访问后缀
  27. * @method float time(bool $float = false) static 获取当前请求的时间
  28. * @method mixed type() static 当前请求的资源类型
  29. * @method void mimeType(mixed $type, string $val = '') static 设置资源类型
  30. * @method string method(bool $method = false) static 当前的请求类型
  31. * @method bool isGet() static 是否为GET请求
  32. * @method bool isPost() static 是否为POST请求
  33. * @method bool isPut() static 是否为PUT请求
  34. * @method bool isDelete() static 是否为DELTE请求
  35. * @method bool isHead() static 是否为HEAD请求
  36. * @method bool isPatch() static 是否为PATCH请求
  37. * @method bool isOptions() static 是否为OPTIONS请求
  38. * @method bool isCli() static 是否为cli
  39. * @method bool isCgi() static 是否为cgi
  40. * @method mixed param(string $name = '', mixed $default = null, mixed $filter = '') static 获取当前请求的参数
  41. * @method mixed route(string $name = '', mixed $default = null, mixed $filter = '') static 设置获取路由参数
  42. * @method mixed get(string $name = '', mixed $default = null, mixed $filter = '') static 设置获取GET参数
  43. * @method mixed post(string $name = '', mixed $default = null, mixed $filter = '') static 设置获取POST参数
  44. * @method mixed put(string $name = '', mixed $default = null, mixed $filter = '') static 设置获取PUT参数
  45. * @method mixed delete(string $name = '', mixed $default = null, mixed $filter = '') static 设置获取DELETE参数
  46. * @method mixed patch(string $name = '', mixed $default = null, mixed $filter = '') static 设置获取PATCH参数
  47. * @method mixed request(string $name = '', mixed $default = null, mixed $filter = '') static 获取request变量
  48. * @method mixed session(string $name = '', mixed $default = null, mixed $filter = '') static 获取session数据
  49. * @method mixed cookie(string $name = '', mixed $default = null, mixed $filter = '') static 获取cookie参数
  50. * @method mixed server(string $name = '', mixed $default = null, mixed $filter = '') static 获取server参数
  51. * @method mixed env(string $name = '', mixed $default = null, mixed $filter = '') static 获取环境变量
  52. * @method mixed file(string $name = '') static 获取上传的文件信息
  53. * @method mixed header(string $name = '', mixed $default = null) static 设置或者获取当前的Header
  54. * @method mixed input(array $data,mixed $name = '', mixed $default = null, mixed $filter = '') static 获取变量 支持过滤和默认值
  55. * @method mixed filter(mixed $filter = null) static 设置或获取当前的过滤规则
  56. * @method mixed has(string $name, string $type = 'param', bool $checkEmpty = false) static 是否存在某个请求参数
  57. * @method mixed only(mixed $name, string $type = 'param') static 获取指定的参数
  58. * @method mixed except(mixed $name, string $type = 'param') static 排除指定参数获取
  59. * @method bool isSsl() static 当前是否ssl
  60. * @method bool isAjax(bool $ajax = false) static 当前是否Ajax请求
  61. * @method bool isPjax(bool $pjax = false) static 当前是否Pjax请求
  62. * @method mixed ip(int $type = 0, bool $adv = true) static 获取客户端IP地址
  63. * @method bool isMobile() static 检测是否使用手机访问
  64. * @method string scheme() static 当前URL地址中的scheme参数
  65. * @method string query() static 当前请求URL地址中的query参数
  66. * @method string host(bool $stric = false) static 当前请求的host
  67. * @method string port() static 当前请求URL地址中的port参数
  68. * @method string protocol() static 当前请求 SERVER_PROTOCOL
  69. * @method string remotePort() static 当前请求 REMOTE_PORT
  70. * @method string contentType() static 当前请求 HTTP_CONTENT_TYPE
  71. * @method array routeInfo() static 获取当前请求的路由信息
  72. * @method array dispatch() static 获取当前请求的调度信息
  73. * @method string module() static 获取当前的模块名
  74. * @method string controller(bool $convert = false) static 获取当前的控制器名
  75. * @method string action(bool $convert = false) static 获取当前的操作名
  76. * @method string langset() static 获取当前的语言
  77. * @method string getContent() static 设置或者获取当前请求的content
  78. * @method string getInput() static 获取当前请求的php://input
  79. * @method string token(string $name = '__token__', mixed $type = 'md5') static 生成请求令牌
  80. * @method string cache(string $key, mixed $expire = null, array $except = [], string $tag = null) static 设置当前地址的请求缓存
  81. * @method string getCache() static 读取请求缓存设置
  82. */
  83. class Request extends Facade
  84. {
  85. /**
  86. * 获取当前Facade对应类名(或者已经绑定的容器对象标识)
  87. * @access protected
  88. * @return string
  89. */
  90. protected static function getFacadeClass()
  91. {
  92. return 'request';
  93. }
  94. }