laravel 命令行测试 Uncaught ReflectionException: Class config does not exist

require __DIR__ . '/vendor/autoload.php';
$app = require_once __DIR__ . '/bootstrap/app.php';

config('any');

解决办法:

require __DIR__ . '/vendor/autoload.php';
$app = require_once __DIR__ . '/bootstrap/app.php';

(new \Illuminate\Foundation\Bootstrap\LoadConfiguration)->bootstrap($app);
config('any');

 使用 (new \Illuminate\Foundation\Bootstrap\LoadConfiguration)->bootstrap($app); 加载配置

猜你喜欢

转载自www.cnblogs.com/eleven24/p/10475177.html