简体   繁体   English

如何在 laravel 中永久更改配置文件

[英]how to make changes to config file permanently in laravel

In Laravel using Config:set('database.connections.mysql.host','localhost') make changes to the config file temporarily for the current user only, and it also does not make changes to the config file also.在 Laravel 中使用Config:set('database.connections.mysql.host','localhost')只为当前用户临时更改配置文件,它也不会更改配置文件。 How can I make changes to the config file permanently so that it affects all users and if I opens the config file the I get the changed values.如何永久更改配置文件,使其影响所有用户,如果我打开配置文件,我会得到更改后的值。

You should just go to the config file itself and set it manually there.你应该去配置文件本身并在那里手动设置它。 if what you want is to dynamically set a config variable permanently then i recommend https://github.com/Phil-F/Setting/如果您想要永久动态设置配置变量,那么我推荐https://github.com/Phil-F/Setting/

Note that this will not change any of the laravel config.请注意,这不会更改任何 laravel 配置。 Instead it creates a json based config alongside, though it can also do clever stuff like use laravel config as a fallback option.相反,它会创建一个基于 json 的配置,尽管它也可以做一些聪明的事情,比如使用 laravel 配置作为后备选项。

As for https://github.com/daftspunk/laravel-config-writer , i was unable to get this working.至于https://github.com/daftspunk/laravel-config-writer ,我无法让它工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM