laravel配置文件存放目录config里面的文件是自定加载的,也就是说,你在文件夹里面新建一个custom.php,按配置格式写,是可以正常访问的.

 

1.读取配置的方法:

$value = config('app.timezone');

即使用内置的config函数+配置文件名+配置参数名方式来读取配置的值

2.设置配置的方法(只是在运行时(runtime)配置,不会写入到配置文件里)

config(['app.timezone' => 'Asia/Shanghai']);

PS:上面用了数组的省略写法

3.缓存配置

php artisan config:cache

4.临时关闭网站

php artisan down

再打开

php artisan up

 

 

配置文件的自动加载,读取等:

https://laravel-china.org/articles/5640/laravel-config-configuration-file-loading-and-source-code-analysis

 

 

 

参考:https://www.cnblogs.com/tujia/p/6222603.html

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2021-08-28
猜你喜欢
  • 2021-11-23
  • 2021-11-23
  • 2021-05-25
  • 2021-09-21
相关资源
相似解决方案