我在将本地laravel代码迁移到服务器时遇到此错误。 stackoverflow上仍然没有回答此问题。 我已经运行了命令:
composer update -vv
composer install
chmod -r 777 storage/
chmod -r 777 app/storage
问题详情如下:
Catchable fatal error: Argument 1 passed to Illuminate\\Foundation\\Application::__construct() must be an instance of Illuminate\\Http\\Request, string given, called in /home/33128-24818.cloudwaysapps.com/asmmvdanac/public_html/bootstrap/app.php on line 16 and defined in /home/33128-24818.cloudwaysapps.com/asmmvdanac/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php on line 109
Stack trace:
1. {main}() /home/33128-24818.cloudwaysapps.com/asmmvdanac/public_html/public/index.php:0
2. require_once() /home/33128-24818.cloudwaysapps.com/asmmvdanac/public_html/public/index.php:35
3. Illuminate\\Foundation\\Application->__construct() /home/33128-24818.cloudwaysapps.com/asmmvdanac/public_html/bootstrap/app.php:16
app.php
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
'Illuminate\Contracts\Http\Kernel',
'App\Http\Kernel'
);
$app->singleton(
'Illuminate\Contracts\Console\Kernel',
'App\Console\Kernel'
);
$app->singleton(
'Illuminate\Contracts\Debug\ExceptionHandler',
'App\Exceptions\Handler'
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;