Laravel刀片循环通过配置数组变量
在我的config/locale.php中,我有一个数组'displayLanguage',其中包含key=>value对 如何在blade中循环通过此阵列? 我试过以下方法Laravel刀片循环通过配置数组变量,laravel,config,blade,Laravel,Config,Blade,在我的config/locale.php中,我有一个数组'displayLanguage',其中包含key=>value对 如何在blade中循环通过此阵列? 我试过以下方法 @foreach ( {{ Config::get('app.locale.displayLanguage') }} as $itemKey => $itemVal) {{ $itemKey }} @endforeach 我收到语法错误,意外的“如果文件位于config/locale.php中,
@foreach ( {{ Config::get('app.locale.displayLanguage') }} as $itemKey => $itemVal)
{{ $itemKey }}
@endforeach
我收到语法错误,意外的“如果文件位于
config/locale.php
中,则调用config('locale.displayLanguage')
我正在刀片文件中使用全局帮助器config()
在foreach
循环中似乎还有额外的花括号
@foreach(config('locale.displayLanguage') as $key => $value)
{{ $key }}
@endforeach