php - 在 API Guzzle HTTP 中获取 Laravel Http 中的私有属性
问题描述
我想在调用方法时将响应数据(如私有属性)存储到变量中
use Illuminate\Support\Facades\Http;
public function myMethod(){
$result = [];
$response = Http::asForm()->withHeaders([
'origin' => 'https://example.com',
'content-type' => 'application/x-www-form-urlencoded',
'referer' => 'https://example.com',
])->post('https://example.com', [
'email' => 'example@gmail.com',
'pass' => 'mypassword',
'login' => 'Log+In',
'withCredentials' => true,
]);
$result = $response;
}
结果:
但我不能在这个结果中使用键
解决方案
推荐阅读
- python - 由于无限页面加载,无法通过 python 中的 selenium 进行抓取
- python - 从数据框列表中获取数据框名称
- c# - 我是否必须在每个请求前添加 SecurityProtocol?VB.Net / C#
- java - 默认 Spring 错误响应的 JSON 模式是什么?
- android - create-react-native-app 混淆不是创建 App.js 文件
- sql - 在 VB.net 中创建 SQL 参数 char(7)
- react-native - react-native-obfuscating-transformer 不会混淆任何代码
- redis - Redis SMEMBERS 是确定性的吗?
- reactjs - 如何在反应中解析/比较时刻对象?
- r - ggplot 中有没有办法在具有不同字体类型的相同 x 轴标签中拥有 2 个不同的变量?