当我尝试运行php artisan
时,我给出了错误
[Error Exception]
Undefined offset: 0
当我运行composer install
或composer update
时,我收到此错误
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
我安装了所有扩展,运行composer dumpautoload
但仍然收到此错误。 问题出在这个当前的 procjet(我创建了另一个 Laravel 项目,它工作正常)
最后我发现在服务提供商中,在引导方法中,有返回 false 的数据库查询,因此不存在索引为 0 的 array(我放置数据库查询结果的位置)
$result[0]->title // <---doesnt exist($result is empty)