PHPackages                             ihexiang/requests - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. ihexiang/requests

ActiveLibrary[HTTP &amp; Networking](/categories/http)

ihexiang/requests
=================

PHP Requests 支持 GET、POST、PUT、PATCH、DELETE、HEAD、OPTIONS 等请求

v1.0.1(6y ago)321986[2 PRs](https://github.com/ihexiang/requests/pulls)Apache-2.0PHPPHP &gt;=5.4.0

Since Jun 25Pushed 6y agoCompare

[ Source](https://github.com/ihexiang/requests)[ Packagist](https://packagist.org/packages/ihexiang/requests)[ RSS](/packages/ihexiang-requests/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (3)Used By (0)

requests
========

[](#requests)

#### 介绍

[](#介绍)

PHP Requests 支持 GET、POST、PUT、PATCH、DELETE、HEAD、OPTIONS 等方法

#### 运行环境

[](#运行环境)

- PHP版本 ( &gt;= 5.4 )
- composer

#### 安装

[](#安装)

composer require ihexiang/requests v1.0.1

#### 支持的方法

[](#支持的方法)

- GET [示例](./example/get.php)
- POST [示例](./example/post.php)
- PUT [示例](./example/put.php)
- PATCH [示例](./example/patch.php)
- DELETE [示例](./example/delete.php)
- HEAD [示例](./example/head.php)
- OPTIONS [示例](./example/options.php)

#### 响应 Response

[](#响应-response)

- 每一个请求都返回一个响应对象 response
- 成员属性

    - header 响应头信息
    - http\_code HTTP code 码
    - body 响应内容体
    - erron 错误码
    - error 错误消息
- 成员方法

    - content() 获取文本类型的 响应内容
    - toArray(dataType) 获取数组类型的 响应内容

#### 示例

[](#示例)

```
