我正在與SammyK/LaravelFacebookSdk試驗。 試圖運行這條線從例如: $response = Facebook::get('/me?fields=id,name,email', 'user-access-token');
參數3傳遞給GuzzleHttp 客戶::請求()必須是類型的陣列,串給出
其進而運行/var/www/vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php line 61
public function send($url, $method, $body, array $headers, $timeOut)
{
$options = [
'headers' => $headers,
'body' => $body,
'timeout' => $timeOut,
'connect_timeout' => 10,
'verify' => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
];
$request = $this->guzzleClient->createRequest($method, $url, $options);
try {
$rawResponse = $this->guzzleClient->send($request);
} catch (RequestException $e) {
$rawResponse = $e->getResponse();
if ($e->getPrevious() instanceof RingException || !$rawResponse instanceof ResponseInterface) {
throw new FacebookSDKException($e->getMessage(), $e->getCode());
}
}
$rawHeaders = $this->getHeadersAsString($rawResponse);
$rawBody = $rawResponse->getBody();
$httpStatusCode = $rawResponse->getStatusCode();
return new GraphRawResponse($rawHeaders, $rawBody, $httpStatusCode);
}
這要求/var/www/vendor/guzzlehttp/guzzle/src/Client.php line 87
public function __call($method, $args)
{
if (count($args) < 1) {
throw new \InvalidArgumentException('Magic request methods require a URI and optional options array');
}
$uri = $args[0];
$opts = isset($args[1]) ? $args[1] : [];
return substr($method, -5) === 'Async'
? $this->requestAsync(substr($method, 0, -5), $uri, $opts)
: $this->request($method, $uri, $opts);
}
本法干擾解釋輸入作爲array('method' => 'createRequest', 'uri' => 'GET'))
改變指數似乎糾正錯誤(儘管其他) r問題araise)
$uri = $args[1];
$opts = isset($args[2]) ? $args[2] : [];
但是,由於編輯其他軟件包是一種非常糟糕的做法,我該如何糾正這個錯誤?
埃德蒙嗨,不知道你是否已經找到了解決方案?我在這裏遇到了同樣的問題:( –
@KeithYeoh我傾倒了插件,自己寫了代碼或者使用了Socialte(laravels官方插件)+一些客戶代碼,我不記得,我只記得我的解決方案感覺比插件更乾淨,更簡單 –