我正在开发一个将文件从google驱动器上传和显示到网站的应用程序,为此,我在php中使用google驱动器api,我在输入验证代码时遵循了quickstart.php,它显示了一些错误。
PHP致命错误: Uncaught : count():参数#1 ($value)必须是可数型的Countable数组,null在D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:67堆栈跟踪中给出:#0 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(67):count() #1 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(141):GuzzleHttp\Handler\CurlFactory->D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(67):()2D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(103):GuzzleHttp\Handler\CurlFactory::finishError() #3 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43):GuzzleHttp\Handler\CurlFactory: D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(28):#4 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(28):GuzzleHttp\Handler\CurlHandler->__调用() #5 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(51):GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler{closure}() #6 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\PrepareBodyMiddleware.php(72):GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler{closure}() #7 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\srcD:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\RedirectMiddleware.php(68):(30):GuzzleHttp\PrepareBody中间件->_invoke() #8 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Middleware.php(57):GuzzleHttp\中间件:GuzzleHttp{闭包}() #9 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Middleware.php(57):GuzzleHttp\Redirect中间件->__ D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp () #10 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttpD:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Client.php(268):(67):\guzzle\src\HandlerStack.php(67):GuzzleHttp\中间件:GuzzleHttp{闭包}() #11 \guzzle\src\HandlerStack.php GuzzleHttp\HandlerStack->_\guzzle\src\HandlerStack.php() #12 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Client.php(96):GuzzleHttp\Client->transfer() #13D:\xampp\htdocs\google-驱动器-api\供应商\D:\xampp\htdocs\google-drive-api\vendor\google\auth\src\HttpHandler\Guzzle6HttpHandler.php(34):(104):GuzzleHttp\Client->sendAsync() #14 D:\xampp\htdocs\google-drive-api\vendor\google\auth\src\OAuth2.php(492):GuzzleHttp\Client->send() #15 D:\xampp\htdocs\google-drive-api\vendor\google\auth\src\OAuth2.php(492):Google\Auth\HttpHandle#16 D:\xampp\htdocs\google-drive-api\vendor\google\apiclient\src\GoogleD:\xampp\htdocs\google-drive-api\google-drive.php(52):_\Client.php_ \Client.php(184):Google\OAuth2-> D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php #17 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php_\Client.php_Client->D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php第67行中抛出的D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php #18 D:\xampp\htdocs\google-drive-api\google-drive.php(70):getClient() #19 {main}
发布于 2021-04-09 06:25:15
肯定是php版本的问题。我在php8上,也面临着同样的问题,但当我更改为php7.3时,错误就变成了警告。因为php7.4和更高版本的主要更改可能导致count()的错误。
https://stackoverflow.com/questions/65391718
复制相似问题