当前位置:  开发笔记 > 编程语言 > 正文

HtmlServiceProvider.php第36行中的FatalErrorException:laravel

如何解决《HtmlServiceProvider.php第36行中的FatalErrorException:laravel》经验,为你挑选了2个好方法。

我正在使用laravel 5.2并且我在HtmlServiceProvider.php第36行中遇到错误FatalErrorException:调用未定义的方法Illuminate\Foundation\Application :: bindShared()

我的app.php文件是

 env('APP_ENV', 'production'),


    'debug' => env('APP_DEBUG', false),


    'url' => 'http://localhost',


    'timezone' => 'UTC',


    'locale' => 'en',


    'fallback_locale' => 'en',


    'key' => env('APP_KEY'),

    'cipher' => 'AES-256-CBC',


    'log' => env('APP_LOG', 'single'),


    'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        Illuminate\Auth\AuthServiceProvider::class,
        Illuminate\Broadcasting\BroadcastServiceProvider::class,
        Illuminate\Bus\BusServiceProvider::class,
        Illuminate\Cache\CacheServiceProvider::class,
        Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
        Illuminate\Cookie\CookieServiceProvider::class,
        Illuminate\Database\DatabaseServiceProvider::class,
        Illuminate\Encryption\EncryptionServiceProvider::class,
        Illuminate\Filesystem\FilesystemServiceProvider::class,
        Illuminate\Foundation\Providers\FoundationServiceProvider::class,
        Illuminate\Hashing\HashServiceProvider::class,
        Illuminate\Mail\MailServiceProvider::class,
        Illuminate\Pagination\PaginationServiceProvider::class,
        Illuminate\Pipeline\PipelineServiceProvider::class,
        Illuminate\Queue\QueueServiceProvider::class,
        Illuminate\Redis\RedisServiceProvider::class,
        Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
        Illuminate\Session\SessionServiceProvider::class,
        Illuminate\Translation\TranslationServiceProvider::class,
        Illuminate\Validation\ValidationServiceProvider::class,
        Illuminate\View\ViewServiceProvider::class,
        'Illuminate\Html\HtmlServiceProvider',

        /*
         * Application Service Providers...
         */
        App\Providers\AppServiceProvider::class,
        App\Providers\AuthServiceProvider::class,
        App\Providers\EventServiceProvider::class,
        App\Providers\RouteServiceProvider::class,

    ],


    'aliases' => [

        'App'       => Illuminate\Support\Facades\App::class,
        'Artisan'   => Illuminate\Support\Facades\Artisan::class,
        'Auth'      => Illuminate\Support\Facades\Auth::class,
        'Blade'     => Illuminate\Support\Facades\Blade::class,
        'Cache'     => Illuminate\Support\Facades\Cache::class,
        'Config'    => Illuminate\Support\Facades\Config::class,
        'Cookie'    => Illuminate\Support\Facades\Cookie::class,
        'Crypt'     => Illuminate\Support\Facades\Crypt::class,
        'DB'        => Illuminate\Support\Facades\DB::class,
        'Eloquent'  => Illuminate\Database\Eloquent\Model::class,
        'Event'     => Illuminate\Support\Facades\Event::class,
        'File'      => Illuminate\Support\Facades\File::class,
        'Gate'      => Illuminate\Support\Facades\Gate::class,
        'Hash'      => Illuminate\Support\Facades\Hash::class,
        'Lang'      => Illuminate\Support\Facades\Lang::class,
        'Log'       => Illuminate\Support\Facades\Log::class,
        'Mail'      => Illuminate\Support\Facades\Mail::class,
        'Password'  => Illuminate\Support\Facades\Password::class,
        'Queue'     => Illuminate\Support\Facades\Queue::class,
        'Redirect'  => Illuminate\Support\Facades\Redirect::class,
        'Redis'     => Illuminate\Support\Facades\Redis::class,
        'Request'   => Illuminate\Support\Facades\Request::class,
        'Response'  => Illuminate\Support\Facades\Response::class,
        'Route'     => Illuminate\Support\Facades\Route::class,
        'Schema'    => Illuminate\Support\Facades\Schema::class,
        'Session'   => Illuminate\Support\Facades\Session::class,
        'Storage'   => Illuminate\Support\Facades\Storage::class,
        'URL'       => Illuminate\Support\Facades\URL::class,
        'Validator' => Illuminate\Support\Facades\Validator::class,
        'View'      => Illuminate\Support\Facades\View::class,
        'Form'      => 'Illuminate\Html\FormFacade',
        'Html'      => 'Illuminate\Html\HtmlFacade',

    ],

];

并且signup_form.blade.php文件是

signupform

和我的routes.php文件



每当我在浏览器中打开表单时,它都会显示上述错误.



1> Marcin Nabia..:

您需要删除:

'Illuminate\Html\HtmlServiceProvider',

'Form'      => 'Illuminate\Html\FormFacade',
'Html'      => 'Illuminate\Html\HtmlFacade',

形成你的`config/app.php

然后从你的删除composer.json illuminate/html然后添加到你的composer.json:

"laravelcollective/html": "5.*"

require部分

然后运行 composer install

此外,您需要按照https://laravelcollective.com/docs/5.1/html#installation的说明完成此软件包安装

EDIT IT可能因此而无法工作:https://github.com/LaravelCollective/html/issues/133 - 它可能在合并此PR后解决:https://github.com/illuminate/html /拉/ 31 /文件



2> 小智..:

首先,在composer.json文件中需要替换:

"illuminate/html": "^5.0"

"laravelcollective/html":"5.2.*"

接下来,您需要在终端中输入以下命令从终端更新作曲家:composer update.

接下来,在config/app.php文件中,替换:

'Illuminate\Html\HtmlServiceProvider::class'`

'Collective\Html\HtmlServiceProvider::class'

接下来,替换这两个类别名:

'Form'      => Illuminate\Html\FormFacade::class,
'Html'      => Illuminate\Html\HtmlFacade::class, 

'Form'      => Collective\Html\FormFacade::class,
'Html'      => Collective\Html\HtmlFacade::class,

最后,您需要通过将"web"中间件替换为以下内容来更新routes.php文件:

Route::group(['middleware' => ['web']], function () use ($router) {
    $router->resource('blogs', 'BlogsController');
});

推荐阅读
郑小蒜9299_941611_G
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有