这是heroku的日志,我以前版本的代码运行得很完美,但是我更改了一些代码并出现了这个错误。回滚不能解决相同的错误.
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/php
-----> PHP app detected
-----> Bootstrapping...
-----> Installing platform packages...
- php (8.1.0)
- ext-mbstring (bundled with php)
- composer (2.1.14)
- apache (2.4.51)
- nginx (1.20.2)
-----> Installing dependencies...
PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /tmp/build_3007ab05/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1349发布于 2021-12-13 02:47:55
我最近也犯了同样的错误。我的本地php版本为8.0.13,运行良好,但当我将其上传到heroku (这里使用的php版本为8.1)时,我得到了错误。
为了解决这个问题,我将composer.json中的php版本指定为与我使用的本地php版本完全相同的版本,如下所示:
{
"require": {
"php": "8.0.13"
}
}不要忘记更新composer.lock,然后上传到heroku。Heroku将使用这个精确的版本。
我知道不建议为每个https://devcenter.heroku.com/articles/php-support指定确切的版本,但作为一种解决办法,它工作得很好。
https://stackoverflow.com/questions/70324790
复制相似问题