我的 php 腳本有問(wèn)題。 (我和我的朋友寫(xiě)這篇文章,對(duì)錯(cuò)誤表示歉意) 這是向我展示的錯(cuò)誤:致命錯(cuò)誤:未捕獲 InvalidArgumentException:json_decode 錯(cuò)誤: 語(yǔ)法錯(cuò)誤在 /opt/html/wordpress_eagle/forums/vendor/guzzlehttp/guzzle/src/functions.php:306堆棧跟蹤:#0 /opt/html/wordpress_eagle/forums/vendor/restcord/restcord/src/DiscordClient.php(229): GuzzleHttp\json_decode('')#1 /opt/html/wordpress_eagle/forums/vendor/restcord/restcord/src/DiscordClient.php(184): RestCord\DiscordClient->convertResponseToResult('guild', Array, 對(duì)象(GuzzleHttp\Psr7\Response),對(duì)象(GuzzleHttp\Command\Command))#2 /opt/html/wordpress_eagle/forums/vendor/guzzlehttp/command/src/ServiceClient.php(215): RestCord\DiscordClient->RestCord{closure}(對(duì)象(GuzzleHttp\Psr7\Response), 對(duì)象(GuzzleHttp\Psr7\Request),對(duì)象(GuzzleHttp\Command\Command))#3 /opt/html/wordpress_eagle/forums/vendor/guzzlehttp/command/src/ServiceClient.php(177): GuzzleHttp\Command\ServiceClient->transformResponseToResult(Object(GuzzleHttp\Psr7\Response), 對(duì)象(GuzzleHttp\Psr7\Request),對(duì)象(GuzzleHttp\Command\Command))#4 [內(nèi)部函數(shù)]:/opt/html/wordpress_eagle/forums/vendor/guzzlehttp/command/src/Exception/CommandException.php 中的 GuzzleHtt 第 57 行這是 json_decode 拋出錯(cuò)誤 GuzzleHttp/src/functions.php 的地方: https://github.com/guzzle/guzzle/blob/4.1.0/src/functions.php#L305* * @param string $json JSON data to parse * @param bool $assoc When true, returned objects will be converted * into associative arrays. * @param int $depth User specified recursion depth. * @param int $options Bitmask of JSON decode options. * * @return mixed * @throws \InvalidArgumentException if the JSON cannot be decoded. * @link http://www.php.net/manual/en/function.json-decode.php */
1 回答

Smart貓小萌
TA貢獻(xiàn)1911條經(jīng)驗(yàn) 獲得超7個(gè)贊
解決方案:我使用的是舊的 API,我用新的 Restcord 替換了舊的 Restcord,現(xiàn)在一切正常。
- 1 回答
- 0 關(guān)注
- 164 瀏覽
添加回答
舉報(bào)
0/150
提交
取消