我只是从Laravel4.2升级到Laravel5.3,它也可以在Localhost中运行,但是当上传到服务器时我得到以下错误。
糟糕,看起来出了问题。
1/1
FatalThrowableError in AppServiceProvider.php line 18:
Class 'App\Providers\URL' not found
in AppServiceProvider.php line 18
at AppServiceProvider->boot()
at call_user_func_array(array(object(AppServiceProvider), 'boot'), array()) in Container.php line 508
at Container->call(array(object(AppServiceProvider), 'boot')) in /var/www/backoffice/vendor/laravel/framework/src/Illuminate/Foundation/Application.php line 769
at Application->bootProvider(object(AppServiceProvider)) in /var/www/backoffice/vendor/laravel/framework/src/Illuminate/Foundation/Application.php line 752
at Application->Illuminate\Foundation\{closure}(object(AppServiceProvider), '15')
at array_walk(array(object(EventServiceProvider), object(RoutingServiceProvider), object(AuthServiceProvider), object(CookieServiceProvider), object(DatabaseServiceProvider), object(EncryptionServiceProvider), object(FilesystemServiceProvider), object(FoundationServiceProvider), object(NotificationServiceProvider), object(PaginationServiceProvider), object(SessionServiceProvider), object(ViewServiceProvider), object(HtmlServiceProvider), object(ExcelServiceProvider), object(DatatablesServiceProvider), object(AppServiceProvider), object(AuthServiceProvider), object(EventServiceProvider), object(RouteServiceProvider)), object(Closure)) in Application.php line 753
at Application->boot() in BootProviders.php line 17
at BootProviders->bootstrap(object(Application)) in Application.php line 203
at Application->bootstrapWith(array('Illuminate\Foundation\Bootstrap\DetectEnvironment', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', 'Illuminate\Foundation\Bootstrap\ConfigureLogging', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\RegisterProviders', 'Illuminate\Foundation\Bootstrap\BootProviders')) in Kernel.php line 253
at Kernel->bootstrap() in Kernel.php line 144
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
at Kernel->handle(object(Request)) in index.php line 53
答案 0 :(得分:2)
我知道这个问题已经解决了一段时间,并且由于无法使用建议的答案来解决,因此我想发布一下它如何为我服务,以防其他人遇到相同的问题。
# app/Providers/AppServiceProvider.php
use Illuminate\Support\Facades\URL;
我希望这将来对某人有用。
答案 1 :(得分:1)
将此命名空间用于AppServiceProvider.php(/ app / providers)
use Illuminate\Support\ServiceProvider;
为什么要使用此(' App \ Providers \ URL')命名空间?如果没有必要,请将其删除
答案 2 :(得分:0)
当我将laravel应用强制为https时,这对我有用 我还使用了现在位于laravel中的TrustedProxies
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\URL;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
// force HTTPS
URL::forceSchema('https');
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}