简体   繁体   English

laravel autoload.php不能包括在内

[英]laravel autoload.php cannot be included

I am trying to use vendor/autoload but it keep giving me this error: 我正在尝试使用供应商/自动加载,但它一直给我这个错误:

Illuminate\View\Engines\PhpEngine::main(): Failed opening required 'vendor/autoload.php' (include_path='C:\xampp\php\PEAR')

I check that it is because of the path problem but nothing works: Some said that it should be something like this based on my autoload.php: 我检查这是由于路径问题造成的,但没有任何效果:有人说基于我的autoload.php应该是这样的:

require_once __DIR__ . '/vendor/autoload.php'; //but doesn't work

And some said that it is already there so there is no need for require autoload and all I have to do is composer dump-autoload but still nothing. 有人说它已经存在了,所以不需要require自动加载,我要做的就是composer dump-autoload,但仍然一无所获。 Based on this link, Laravel 5 how to include autoload.php 基于此链接, Laravel 5如何包含autoload.php

this is my autoload file: (located at \\project\\vendor) 这是我的自动加载文件:(位于\\ project \\ vendor)

<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit63603d79616e7bbd4553d0e6de44e738::getLoader();

Can someone help me with this problem? 有人可以帮我解决这个问题吗? Thanks in advance 提前致谢

Which file contains the line requiring the autoloader? 哪个文件包含需要自动加载器的行? Are you sure that it is placed in the same directory where also the vendor folder is placed? 您确定将其放在供应商文件夹所在的目录中吗?

If you get the error also when you run 如果在运行时也收到错误

composer install

Just run this command first 只需先运行此命令

composer dump-autoload

This command will clean up all compiled files and their paths. 该命令将清除所有编译文件及其路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM