Php 第一页上的强制语言调用Laravel 5.4
我使用Laravel5.4,我的应用程序运行良好。 我的路线和视图正确显示如下:Php 第一页上的强制语言调用Laravel 5.4,php,laravel,localization,Php,Laravel,Localization,我使用Laravel5.4,我的应用程序运行良好。 我的路线和视图正确显示如下: app.de/de app.de/en app.de/de/kontakt app.de/en/contact 在我的第一个页面调用中,我想强制默认lang,就像从app.de重定向到->app.de/de一样 web.php: Route::get('/{locale}', function ($locale) { App::setLocale($locale); return view('welc
app.de/de
app.de/en
app.de/de/kontakt
app.de/en/contact
在我的第一个页面调用中,我想强制默认lang,就像从app.de重定向到->app.de/de一样
web.php:
Route::get('/{locale}', function ($locale) {
App::setLocale($locale);
return view('welcome');});
如何解决此问题?使用从主页重定向到“de”主页的方法非常感谢。此解决方案的工作原理是:
Route::get('/', function () {
return redirect('/de');
});
Route::get('/{locale}', function ($locale) {
App::setLocale($locale);
return view('welcome');
});
Route::get('{locale}/contact', 'ContactController@index');