这个 Laravel 框架业务有点新,请耐心等待。
我想知道为什么每次运行时我的浏览器都会出现以下错误:
$ sudo php artisan serve
Laravel development server started: <http://127.0.0.1:8000>
[Mon Jul 19 08:11:19 2021] PHP 7.4.15 Development Server (http://127.0.0.1:8000) started
是否有人可以帮助我修复它,以便我现有的 php Web 应用程序顺利运行?
statusCode 500
title "Oops Something went wrong!"
message "Oops Something went wrong!"
responseData []
error
type "ErrorException"
message "require(/home/bitnami/api.tudo.com/storage/framework/views/../bootstrap/app.php): failed to open stream: No such file or directory (View: /home/bitnami/api.tudo.com/resources/views/index.blade.php)"
code 0
file "/home/bitnami/api.tudo.com/storage/framework/views/5759a88cbe727d45464c67b328a9f892cc0b9a9c.php"
line 14
**index.php located on the "/public" folder:**
GNU nano 3.2 index.php
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| First we need to get an application instance. This creates an instance
| of the application / container and bootstraps the application so it
| is ready to receive HTTP / Console requests from the environment.
|
*/
$app = require __DIR__.'/../bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$app->run();
我知道这是问题所在,但无法弄清楚如何修复“index.blade.php”以运行 php 网络应用程序。
"**/resources/views**" folder
$ ls
backupfolder index.blade.php mails uploads vendor
index.blade.php
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| First we need to get an application instance. This creates an instance
| of the application / container and bootstraps the application so it
| is ready to receive HTTP / Console requests from the environment.
|
*/
$app = require __DIR__.'/../bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$app->run();
**/routes/v1** folder
/routes/v1$ ls
admin.php common order order.php provider.php service transport user.php web.php
**web.php**
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/
$router->get('/', function () use ($router) {
return view('index');
});
$router->post('verify', 'LicenseController@verify');
$router->post('base', 'V1\Common\CommonController@base');
$router->get('cmspage/{type}', 'V1\Common\CommonController@cmspagetype');
$router->group(['prefix' => 'api/v1'], function ($app) {
$app->post('user/appsettings', 'V1\Common\CommonController@base');
$app->post('provider/appsettings', 'V1\Common\CommonController@base');
$app->get('countries', 'V1\Common\CommonController@countries_list');
$app->get('states/{id}', 'V1\Common\CommonController@states_list');
$app->get('cities/{id}', 'V1\Common\CommonController@cities_list');
$app->post('/{provider}/social/login', 'V1\Common\SocialLoginController@handleSocialLogin');
$app->post('/chat', 'V1\Common\CommonController@chat');
$app->post('/provider/update/location', 'V1\Common\Provider\HomeController@update_location');
});
$router->get('/send/{type}/push', 'V1\Common\SocialLoginController@push');
$router->get('v1/docs', ['as' => 'swagger-v1-lume.docs', 'middleware' => config('swagger-lume.routes.middleware.docs', []), 'uses' => 'V1\Common\SwaggerController@doc
s']);
$router->get('/api/v1/documentation', ['as' => 'swagger-v1-lume.api', 'middleware' => config('swagger-lume.routes.middleware.api', []), 'uses' => 'V1\Common\SwaggerCo
ntroller@api']);
/bootstrap$ ls
app.php
GNU nano 3.2 app.php
<?php
require_once __DIR__.'/../vendor/autoload.php';
try {
(new Dotenv\Dotenv(dirname(__DIR__)))->load();
} catch (Dotenv\Exception\InvalidPathException $e) {
//
}
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| Here we will load the environment and create the application instance
| that serves as the central piece of this framework. We'll use this
| application as an "IoC" container and router for this framework.
|
*/
$app = new Laravel\Lumen\Application(
dirname(__DIR__)
);
$app->withFacades(true,
[
Laravel\Socialite\Facades\Socialite::class => 'Socialite',
Davibennun\LaravelPushNotification\Facades\PushNotification::class => 'PushNotification',
Illuminate\Support\Facades\Notification::class => 'Notification',
\App\Providers\WebPushServiceProvider::class => 'WebPush'
]);
$app->withEloquent();
/*
|--------------------------------------------------------------------------
| Register Container Bindings
|--------------------------------------------------------------------------
|
| Now we will register a few bindings in the service container. We will
| register the exception handler and the console kernel. You may add
| your own bindings here if you like or you can make another file.
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Filesystem\Factory::class,
function ($app) {
return new Illuminate\Filesystem\FilesystemManager($app);
}
);
$app->singleton(
Illuminate\Contracts\Filesystem\Factory::class,
function ($app) {
return new Illuminate\Filesystem\FilesystemManager($app);
}
);
$app->configure('jwt');
$app->configure('cors');
$app->configure('auth');
$app->configure('logging');
$app->configure('settings');
$app->configure('database');
$app->configure('permission');
$app->configure('filesystems');
$app->configure('swagger-lume');
$app->configure('webpush');
/*
|--------------------------------------------------------------------------
| Register Middleware
|--------------------------------------------------------------------------
|
| Next, we will register the middleware with the application. These can
| be global middleware that run before and after each request into a
| route or middleware that'll be assigned to some specific routes.
|
*/
$app->middleware([
// App\Http\Middleware\ExampleMiddleware::class
Barryvdh\Cors\HandleCors::class
]);
$app->routeMiddleware([
'auth' => App\Http\Middleware\Authenticate::class,
'permission' => Spatie\Permission\Middlewares\PermissionMiddleware::class,
'role' => Spatie\Permission\Middlewares\RoleMiddleware::class,
'demo' => App\Http\Middleware\DemoModeMiddleware::class
]);
/*
|--------------------------------------------------------------------------
| Register Service Providers
|--------------------------------------------------------------------------
|
| Here we will register all of the application's service providers which
| are used to bind services into the container. Service providers are
| totally optional, so you are not required to uncomment this line.
|
*/
// $app->register(App\Providers\AppServiceProvider::class);
$app->register(App\Providers\AuthServiceProvider::class);
// $app->register(App\Providers\EventServiceProvider::class);
$app->register(\Tymon\JWTAuth\Providers\LumenServiceProvider::class);
$app->register(Flipbox\LumenGenerator\LumenGeneratorServiceProvider::class);
$app->register(Barryvdh\Cors\ServiceProvider::class);
$app->register(App\Providers\CustomMailServiceProvider::class);
$app->register(Illuminate\Notifications\NotificationServiceProvider::class);
$app->register(Spatie\Permission\PermissionServiceProvider::class);
$app->register(Maatwebsite\Excel\ExcelServiceProvider::class);
$app->register(\SwaggerLume\ServiceProvider::class);
//$app->register(Illuminate\Mail\MailServiceProvider::class);
$app->alias('cache', \Illuminate\Cache\CacheManager::class);
$app->configure('mail');
$app->alias('mailer', Illuminate\Mail\Mailer::class);
$app->alias('mailer', Illuminate\Contracts\Mail\Mailer::class);
$app->alias('mailer', Illuminate\Contracts\Mail\MailQueue::class);
$app->alias('Excel', Maatwebsite\Excel\Facades\Excel::class);
$app->register(Illuminate\Redis\RedisServiceProvider::class);
/*
|--------------------------------------------------------------------------
| Load The Application Routes
|--------------------------------------------------------------------------
|
| Next we will include the routes file so that they can all be added to
| the application. This will provide all of the URLs the application
| can respond to, as well as the controllers that may handle them.
|
*/
$app->router->group([
'namespace' => 'App\Http\Controllers',
], function ($router) {
require __DIR__.'/../routes/v1/web.php';
});
$app->router->group([
'prefix' => 'api/v1/admin',
'as' => 'admin.',
'namespace' => 'App\Http\Controllers',
], function ($router) {
require __DIR__.'/../routes/v1/admin.php';
});
$app->router->group([
'prefix' => 'api/v1/shop',
'as' => 'shop.',
'namespace' => 'App\Http\Controllers',
], function ($router) {
require __DIR__.'/../routes/v1/order.php';
});
$app->router->group([
'prefix' => 'api/v1/user',
'as' => 'user.',
'namespace' => 'App\Http\Controllers',
], function ($router) {
require __DIR__.'/../routes/v1/user.php';
});
$app->router->group([
'prefix' => 'api/v1/provider',
'as' => 'provider.',
'namespace' => 'App\Http\Controllers',
], function ($router) {
require __DIR__.'/../routes/v1/provider.php';
});
return $app;
哦,伙计,我只是希望有人能够应对这个问题的复杂性
[/bootstrap/app.php][1]
[Webrowser error][2]
[routes/v1$ sudo nano web.php ][3]
[resources/views/index.blade.php][4]
[1]: https://i.stack.imgur.com/rhuDc.png
[2]: https://i.stack.imgur.com/H1bWm.png
[3]: https://i.stack.imgur.com/5TWqo.png
[4]: https://i.stack.imgur.com/eRuTm.png
答案 0 :(得分:0)
您可能遇到缓存问题。 Laravel 中有很多清除缓存的命令。
要清除 Laravel 中的缓存,请尝试:
php artisan view:clear
php artisan cache:clear
php artisan config:clear
php artisan cache:clear