gpt4 book ai didi

laravel - 配置::get() 不工作laravel

转载 作者:行者123 更新时间:2023-12-03 22:53:57 27 4
gpt4 key购买 nike

我正在尝试从配置文件访问数组并在我的下拉列表中使用它。

<select id="iconSelector" name="iconChoose" class="form-control" style="width: 100%">
@foreach(array(Config::get('azima')) as $icon)
<option value="{{$icon}}">{{$icon}}</option>
@endforeach
</select>

我在 config 文件夹中有“azima.php”文件,它返回数组,看起来像这样
<?php

return [
"ti-arrow-up",
"ti-arrow-right",
"ti-arrow-left",
"ti-angle-double-up"
];

问题是它在其他项目中运行良好。可能是什么问题呢?

最佳答案

你得到 null可能是因为该文件尚未自动加载。清除缓存和自动加载转储应该可以解决问题

composer dump-autoload
php artisan config:clear
php artisan config:cache

关于laravel - 配置::get() 不工作laravel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45026636/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com