谷歌驱动api验证码中的问题



我正在开发一个应用程序,该应用程序将文件从谷歌驱动器上传并显示到网站,为此我在php中使用谷歌驱动器api,当我输入验证码时,我遵循了quickstart.php,它显示了一些错误

PHP致命错误:Uncaught TypeError:count((:参数#1($value(的类型必须为Countable|array,在D:\examplep\htdocs\google drive api\vendor\guzzlehttp\guzzle \src\Handler\CurlFactory.PHP:67中为null堆栈跟踪:#0 D:\examplep\htdocs\google drive api\vendor\guzzlehttp\guzzle \src\Handler\CurlFactory.php(67(:count((#1 D:\examplep\htdocs\google drive api\vendor\guzzlehttp\guzzle \src\Handler\CurlFactory.php(141(:guzzlehttp\Handler\CurlFactory->release((#2 D:\examplep\htdocs\google drive api\vendor\guzzlehttp\guzzle \src\Handler\CurlFactory.php(103(:guzzlehttp\Handler\CurlFactory::finishError((#3 D:\examplep\htdocs\google drive api\vendor\guzzlehttp\guzzle \src\Handler\CurlHandler.php(43(:guzzlehttp\Handler\CurlFactory::finish((#4 D:\examplep\htdocs\google drive api\vendor\guzzlehttp\guzzle \src\Handler\Proxy.php(28(:guzzlehttp\Handler\CurlHandler-&gt__invoke((#5 D:\examplep\htdocs\google drive api\vendor\guzzlehttp\guzzle \src\Handler\Proxy.php(51(:guzzlehttp\Handler\Proxy::guzzle Http\Handler{closure}((#6 D:\examplep\htdocs\google drive api\vendor\guzzlehttp\guzzle \src\PrepareBodyMiddleware.php(72(:guzzlehttp\Handler\Proxy::guzzle Http\Handler{closure}((#7 D:\examplep\htdocs\google drive api\vendor\guzzlehttp\guzzle \src\Middleware.php(30(:guzzlehttp\PrepareBodyMiddleware-&gt__invoke((#8 D:\examplep\htdocs\google drive api\vendor\guzzlehttp\guzzle \src\RedirectMiddleware.php(68(:guzzlehttp\Middleware::guzzle Http{closure}((#9 D:\examplep\htdocs\google drive api\vendor\guzzlehttp\guzzle \src\Middleware.php(57(:guzzlehttp\RedirectMiddleware-&gt__invoke((#10 D:\examplep\htdocs\google drive api\vendor\guzzlehttp\guzzle \src\HandlerStack.php(67(:guzzlehttp\Middleware::guzzle Http{closure}((#11 D:\examplep\htdocs\google drive api\vendor\guzzlehttp\guzzle \src\Client.php(268(:guzzlehttp\HandlerStack-&gt__invoke((#12 D:\examplep\htdocs\google drive api\vendor\guzzlehttp\guzzle \src\Client.php(96(:guzzlehttp\Client->transfer((#13 D:\examplep\htdocs\google drive api\vendor\guzzlehttp\guzzle \src\Client.php(104(:guzzlehttp\Client->sendAsync((#14 D:\examplep\htdocs\google drive api\vendor\google\auth\src\HttpHandler\Guzzle6HttpHandler.php(34(:GuzzleHttp\Client->send((#15 D:\xamplep\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\google\Client.php(184(:google\auth\OAuth2->fetchAuthToken((#17 D:\examplep\htdocs\google drive api\google drive.php(52(:google_Client->fetchAccessTokenWithAuthCode((#18 D:\examplep\htdocs\google drive api\google drive.php(70(:getClient((#19{main}在第67行的D:\examplep\htdocs\google drive api\vendor\guzzlehttp\guzzle \src\Handler\CurlFactory.php中抛出

从PHP 7.2开始,当传递给count()函数的值不可计数时,它将抛出警告。后来,这在PHP 8.0 中引发了一个致命错误

请参阅https://www.php.net/manual/en/function.count.php

更改日志

版本 描述
PHP 7.2 count()现在将对传递给value参数的无效可计数类型发出警告

php版本一定有问题。我使用的是php8,也面临着同样的问题,但当我更改为php7.3时,错误变成了警告。由于php7.4及更高版本中的主要更改可能会导致count((的错误

最新更新