LARAVEL: main(): 需要打开失败 'vendor\autoload.php'

LARAVEL: main(): Failed opening required 'vendor\autoload.php'

我关注了 this documentation,但我一直收到 main(): Failed opening required 'vendor\autoload.php' 错误,我 运行 composer install 但仍然收到相同的错误。我正在使用 Laravel 并从控制器调用它..

namespace App\Http\Controllers;

require 'vendor/autoload.php';
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Google\Cloud\Speech\SpeechClient;
use Google\Cloud\Speech\StorageClient;
use App\Model\FilesModel;
use Illuminate\Support\Facades\DB;

class FilesController extends Controller
{

    private $project_id;
    private $speech;
    private $options;
    private $storage;

    public function __construct()
    {
        $storage = new StorageClient([
            'keyFile' => json_decode(file_get_contents(public_path() . '/key.json'), true)
        ]);
    ....

如何绕过这个问题?

首先没有必要这样做!因为它包含在所有页面中...
如果你坚持这样做,我认为问题是自动加载文件的地址必须是:

require '../vendor/autoload.php';

我解决了从 Controller 中删除 "require '../vendor/autoload.php';" 句子的问题,并在两个环境(本地和服务器)中工作。我正在使用 Openpay 集成。

这对我来说很难,因为我试图解决编辑路线或更新作曲家之类的问题。