ホームページ >バックエンド開発 >PHPチュートリアル >フォームモジュールを呼び出すときのlaravel 5.2エラー
Call to undefined method Illuminate\Foundation\Application::bindShared()
フォーム ヘルパーと HTML ヘルパーは Laravel 5.0 で非推奨になりました。そのため、デフォルトではフォーム モジュールが Laravel 5.0 フレームワークに依存しています。 5.2 フレームワーク 5.2 での呼び出しには依然として問題が発生します。現時点では 5.2 は修正されていないため、再インストールする必要があります。
1.composer.json ファイルの require に行「laravelcollective/html」を追加します:「~5.0」完成バージョン
"require": { "php": ">=5.5.9", "laravel/framework": "5.2.*", "illuminate/html": "^5.0", "barryvdh/laravel-ide-helper": "v2.1.2", "laravelcollective/html": "~5.0" },
composer。 json の場所 laravel ディレクトリのルート レベルで
2. 次に、コマンド
を実行します。composer update主に、composer
を通じて laravel フレームワーク ファイルを再管理します。以下は更新プロセスです
composer update> php artisan clear-compiledLoading composer repositories with package informationUpdating dependencies (including require-dev) - Removing symfony/yaml (v3.0.1) - Installing symfony/yaml (v3.0.2) Downloading: 100% - Removing phpspec/prophecy (v1.5.0) - Installing phpspec/prophecy (v1.6.0) Downloading: 100% - Removing phpunit/phpunit (4.8.21) - Installing phpunit/phpunit (4.8.23) Downloading: 100% - Removing symfony/css-selector (v3.0.1) - Installing symfony/css-selector (v3.0.2) Downloading: 100% - Removing symfony/dom-crawler (v3.0.1) - Installing symfony/dom-crawler (v3.0.2) Downloading: 100% - Removing paragonie/random_compat (1.1.6) - Installing paragonie/random_compat (v1.2.0) Downloading: 100% - Removing symfony/console (v3.0.1) - Installing symfony/console (v3.0.2) Downloading: 100% - Removing symfony/finder (v3.0.1) - Installing symfony/finder (v3.0.2) Downloading: 100% - Removing symfony/debug (v3.0.1) - Installing symfony/debug (v3.0.2) Downloading: 100% - Removing symfony/http-foundation (v3.0.1) - Installing symfony/http-foundation (v3.0.2) Downloading: 100% - Removing symfony/event-dispatcher (v3.0.1) - Installing symfony/event-dispatcher (v3.0.2) Downloading: 100% - Removing symfony/http-kernel (v3.0.1) - Installing symfony/http-kernel (v3.0.2) Downloading: 100% - Removing symfony/process (v3.0.1) - Installing symfony/process (v3.0.2) Downloading: 100% - Updating symfony/routing (v3.0.1 => v3.0.2) The package has modified files: M .gitignore M Annotation/Route.php M CHANGELOG.md M CompiledRoute.php M Exception/ExceptionInterface.php M Exception/InvalidParameterException.php M Exception/MethodNotAllowedException.php M Exception/MissingMandatoryParametersException.php M Exception/ResourceNotFoundException.php M Exception/RouteNotFoundException.php-10 more files modified, choose "v" to view the full list Discard changes [y,n,v,d,s,?]? y Checking out 4686baa55a835e1c1ede9b86ba02415c8c8d6166 - Removing symfony/translation (v3.0.1) - Installing symfony/translation (v3.0.2) Downloading: 100% - Removing symfony/var-dumper (v3.0.1) - Installing symfony/var-dumper (v3.0.2) Downloading: 100% - Removing laravel/framework (v5.2.12) - Installing laravel/framework (v5.2.16) Downloading: 100% - Installing laravelcollective/html (v5.2.4) Downloading: 100%Writing lock fileGenerating autoload files> php artisan optimizeGenerating optimized class loader
3. 更新が成功したら、config/app.php ファイルを変更して構成を追加します。
#增加providers数组项 'providers' => [ // ... Collective\Html\HtmlServiceProvider::class, // ... ], #增加alias数组项 'aliases' => [ // ... 'Form' => Collective\Html\FormFacade::class, 'Html' => Collective\Html\HtmlFacade::class, // ... ],
以下は完成版
'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, Collective\Html\HtmlServiceProvider::class, #注意,就是这里 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', // Laravel IDE helper /* * Application Service Providers... */ App\Providers\AppServiceProvider::class, App\Providers\AuthServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, ], /* |-------------------------------------------------------------------------- | Class Aliases |-------------------------------------------------------------------------- | | This array of class aliases will be registered when this application | is started. However, feel free to register as many as you wish as | the aliases are "lazy" loaded so they don't hinder performance. | */ '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' => Collective\Html\FormFacade::class,#注意,就是这里 'Html' => Collective\Html\HtmlFacade::class,#注意,就是这里 ],
参考ファイル:
https://laravel.com/docs/5.2/upgrade#upgrade-5.2.0
https:// laravelcollective.com/docs/5.1/html#installation
http://stackoverflow.com/questions/34414389/fatalerrorException-in-htmlserviceprovider-php-line-36-laravel
この記事Peter Yuan によって作成され、表示 - 非営利 2.5 中国本土ライセンスに基づいて公開されました。 転載または引用する前に、著者に連絡し、著者名に署名し、記事の出典を示す必要があります。神のような少年 » フォームモジュール呼び出し時のlaravel 5.2エラー