dongyuan9149
2017-10-31 13:41
浏览 41
已采纳

Laravel:如何将web.php中的变量传递给刀片视图名称

This is my web.php file :

<?php $current_language = app()->getLocale();
Route::get('/',function(){ return view('fr/accueil');});
Route::get('/test',function(){ return view('{$current_language}/test');});

but the current_language variable is not recognized by Laravel, it says that "View [{$current_language}.test] not found.", However, I have fr/test and ar/test blade views. How, Can I pass the value of $current_language? Thanks, a lot.

图片转代码服务由CSDN问答提供 功能建议

这是我的web.php文件:</ p>

 &lt;  ?php $ current_language = app() - &gt; getLocale(); 
Route :: get('/',function(){return view('fr / accueil');}); 
Route :: get('/  test',function(){return view('{current_language} / test');}); 
 </ code> </ pre> 
 
 

但是Laravel无法识别current_language变量, 它说“查看[{$ current_language} .test]未找到。”,但是,我有fr / test和ar / test刀片视图。 怎么样,我可以传递$ current_language的值吗? 谢谢,很多。</ p> </ div>

1条回答 默认 最新

相关推荐 更多相似问题