digphp / request
php request
1.0.0
2022-03-10 05:51 UTC
Requires
- psr/http-message: ^1.0
This package is auto-updated.
Last update: 2025-03-10 12:22:08 UTC
README
请求数据便捷获取类
安装
composer require digphp/request
用例
$request = new \DigPHP\Request\Request('一个 \Psr\Http\Message\ServerRequestInterface 实例'); // 判断是否存在 支持server get post cookie file attr $request->has('server.HTTP_HOST'); $request->has('get.name'); $request->has('post.title'); $request->has('cookie.id'); $request->has('file.cover'); $request->has('attr.login'); // 获取数据 支持server get post cookie file attr等方法 $request->get('somekey', 'defalut val..'); $request->server('HTTP_HOST', 'default val..'); $request->post('somekeyx', 'default val..'); $request->cookie('somekey', 'default val..'); $request->file('somekey', 'default val..'); $request->attr('someatt', 'default val..');