继续收到以下错误:
类Illuminate \ Routing \ Route的对象无法转换为字符串
$response = $client.post('url', [
'body' => [
'blah' => 'blah'
],
'headers' => [
// client id+client secret (base64)
'Authorization' => 'Basic sllalalalal='
]
]);
我没有在任何地方使用路由对象,是数组中所有硬编码的字符串。错误发生的行正好是分号所在的位置。
答案 0 :(得分:2)
将$client.post
更改为$client->post
。目前,您正在尝试连结$client
和post()
。
答案 1 :(得分:0)
composer require "guzzlehttp/guzzle" "~4.0"
$client = new \GuzzleHttp\Client();
$response = $client->post('url', [
'body' => [
'blah' => 'blah'
],
'headers' => [
// client id+client secret (base64)
'Authorization' => 'Basic sllalalalal='
]
]);