CakePHP
  • 文档
    • 书籍
    • API
    • 视频
    • 报告安全问题
    • 隐私政策
    • 标识和商标
  • 商业解决方案
  • 周边产品
  • 自驾游
  • 团队
  • 社区
    • 社区
    • 参与进来
    • 问题 (Github)
    • 烘焙坊
    • 精选资源
    • 培训
    • 聚会
    • 我的 CakePHP
    • CakeFest
    • 时事通讯
    • 领英
    • 优酷
    • 脸书
    • 推特
    • Mastodon
    • 帮助和支持
    • 论坛
    • Stack Overflow
    • IRC
    • Slack
    • 付费支持
CakePHP

C CakePHP 5.1 Chiffon API

  • 项目
    • CakePHP
      • CakePHP
      • Chronos
      • Elastic Search
      • 队列
  • 版本
    • 5.1
      • 5.1
      • 5.0
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

命名空间

  • 全局
  • Cake
    • 缓存
    • 集合
    • 命令
    • 控制台
    • 控制器
    • 核心
    • 数据库
    • 数据源
    • 错误
    • 事件
    • 表单
    • Http
      • 客户端
        • 适配器
        • 认证
        • 异常
      • Cookie
      • 异常
      • 中间件
      • 会话
      • 测试套件
    • 国际化
    • 日志
    • 邮件
    • 网络
    • ORM
    • 路由
    • 测试套件
    • 实用工具
    • 验证
    • 视图

Stream 类

使用 PHP 的流 API 发送 Cake\Http\Client\Request。

这种方法和实现部分借鉴了 Aura.Http。

命名空间: Cake\Http\Client\Adapter

属性摘要

  • $_connectionErrors protected
    数组

    连接错误列表。

  • $_context protected
    资源|null

    流 API 使用的上下文资源。

  • $_contextOptions protected
    array<string, mixed>

    HTTP 流上下文选项/内容数组。

  • $_sslContextOptions protected
    array<string, mixed>

    SSL 流上下文选项/内容数组。

  • $_stream protected
    资源|null

    流资源。

方法摘要

  • _buildContent() protected

    根据请求对象构建请求内容。

  • _buildContext() protected

    根据请求对象构建流上下文。

  • _buildHeaders() protected

    为请求构建头部上下文。

  • _buildOptions() protected

    为请求构建其他选项。

  • _buildResponse() protected

    构建响应对象。

  • _buildSslContext() protected

    为请求构建 SSL 选项。

  • _open() protected

    打开套接字并处理任何连接错误。

  • _send() protected

    打开流并发送请求。

  • contextOptions() public

    获取上下文选项。

  • createResponses() public

    根据头部和内容创建响应列表。

  • send() public

    发送请求并获取响应。

方法详情

_buildContent() ¶ protected

_buildContent(Psr\Http\Message\RequestInterface $request, array<string, mixed> $options): void

根据请求对象构建请求内容。

如果 $request->body() 是一个字符串,它将按原样使用。数组数据将使用 {@link \Cake\Http\Client\FormData} 处理。

参数
Psr\Http\Message\RequestInterface $request

正在发送的请求。

array<string, mixed> $options

要使用的选项数组。

返回值
void

_buildContext() ¶ protected

_buildContext(Psr\Http\Message\RequestInterface $request, array<string, mixed> $options): void

根据请求对象构建流上下文。

参数
Psr\Http\Message\RequestInterface $request

要从中构建上下文的请求。

array<string, mixed> $options

其他请求选项。

返回值
void

_buildHeaders() ¶ protected

_buildHeaders(Psr\Http\Message\RequestInterface $request, array<string, mixed> $options): void

为请求构建头部上下文。

创建 Cookie 和头部。

参数
Psr\Http\Message\RequestInterface $request

正在发送的请求。

array<string, mixed> $options

要使用的选项数组。

返回值
void

_buildOptions() ¶ protected

_buildOptions(Psr\Http\Message\RequestInterface $request, array<string, mixed> $options): void

为请求构建其他选项。

参数
Psr\Http\Message\RequestInterface $request

正在发送的请求。

array<string, mixed> $options

要使用的选项数组。

返回值
void

_buildResponse() ¶ protected

_buildResponse(array $headers, string $body): Cake\Http\Client\Response

构建响应对象。

参数
array $headers

未解析的头部。

string $body

响应主体。

返回值
Cake\Http\Client\Response

_buildSslContext() ¶ protected

_buildSslContext(Psr\Http\Message\RequestInterface $request, array<string, mixed> $options): void

为请求构建 SSL 选项。

参数
Psr\Http\Message\RequestInterface $request

正在发送的请求。

array<string, mixed> $options

要使用的选项数组。

返回值
void

_open() ¶ protected

_open(string $url, Psr\Http\Message\RequestInterface $request): void

打开套接字并处理任何连接错误。

参数
string $url

要连接的 URL。

Psr\Http\Message\RequestInterface $request

请求对象。

返回值
void
抛出
Psr\Http\Client\RequestExceptionInterface

_send() ¶ protected

_send(Psr\Http\Message\RequestInterface $request): array

打开流并发送请求。

参数
Psr\Http\Message\RequestInterface $request

请求对象。

返回值
数组
抛出
Psr\Http\Client\NetworkExceptionInterface

contextOptions() ¶ public

contextOptions(): array<string, mixed>

获取上下文选项。

用于调试和测试上下文创建。

返回值
array<string, mixed>

createResponses() ¶ public

createResponses(array $headers, string $content): arrayCake\Http\Client\Response>

根据头部和内容创建响应列表。

根据发生的重定向次数创建一个或多个响应对象。

参数
array $headers

来自请求的头部列表。

string $content

响应内容。

返回值
arrayCake\Http\Client\Response>

send() ¶ public

send(Psr\Http\Message\RequestInterface $request, array<string, mixed> $options): arrayCake\Http\Client\Response>

发送请求并获取响应。

参数
Psr\Http\Message\RequestInterface $request
array<string, mixed> $options
返回值
arrayCake\Http\Client\Response>

属性详情

$_connectionErrors ¶ protected

连接错误列表。

类型
数组

$_context ¶ protected

流 API 使用的上下文资源。

类型
资源|null

$_contextOptions ¶ protected

HTTP 流上下文选项/内容数组。

类型
array<string, mixed>

$_sslContextOptions ¶ protected

SSL 流上下文选项/内容数组。

类型
array<string, mixed>

$_stream ¶ protected

流资源。

类型
资源|null
OpenHub
Pingping
Linode
  • 商业解决方案
  • 展示
  • 文档
  • 书籍
  • API
  • 视频
  • 报告安全问题
  • 隐私政策
  • 标识和商标
  • 社区
  • 参与进来
  • 问题 (Github)
  • 烘焙坊
  • 精选资源
  • 培训
  • 聚会
  • 我的 CakePHP
  • CakeFest
  • 时事通讯
  • 领英
  • 优酷
  • 脸书
  • 推特
  • Mastodon
  • 帮助和支持
  • 论坛
  • Stack Overflow
  • IRC
  • Slack
  • 付费支持

使用 CakePHP API 文档 生成