【问题标题】:How can I access the variable "verify" from following instance?如何从以下实例访问变量“验证”?
【发布时间】:2019-06-03 03:14:50
【问题描述】:

我有想要访问特定变量的实例的响应

我尝试了不同的组合,使用箭头运算符。

Client {#445 ▼
  -httpClient: Client {#460 ▼
   -client: Client {#469 ▼
   -config: array:7 [▼
    "handler" => HandlerStack {#459 ▶}
    "allow_redirects" => array:5 [▶]
    "http_errors" => true
    "decode_content" => true
    "verify" => true
    "cookies" => false
    "headers" => array:1 [▼
      "User-Agent" => "GuzzleHttp/6.3.3 curl/7.50.1 PHP/7.0.10"
    ]
  ]
}

我想访问数组变量,例如 handler、verify 和 cookies。

【问题讨论】:

  • 请向我们展示您的尝试,以便我们帮助您自助。
  • 我试过 var_dump($this->httpClient); var_dump($this->httpClient->getConfig());

标签: php guzzle guzzle6 omnipay


【解决方案1】:

您应该能够使用 '$client->getConfig()' 调用从 Guzzle 客户端获取配置(如果 $client 是您的 \GuzzleHttp\Client 实例)。

看这里的代码:https://github.com/guzzle/guzzle/blob/6.3.3/src/Client.php#L134

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多