We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
版本:ThinkPHP v6.0.12
我定义了一个service,在boot()或者register()方法中使用如下代码动态修改配置信息,会出现部分修改后的配置不生效的问题,代码如下:
service
boot()
register()
public function boot() { // 修改文件系统配置 $filesystem = config('filesystem'); $filesystem['disks']['public']['url'] = '/storage/test'; $filesystem['disks']['public']['root'] = $this->app->getRootPath().'public'.DIRECTORY_SEPARATOR.'storage'.DIRECTORY_SEPARATOR.'test'; config(['filesystem' => $filesystem]); // 修改缓存配置 $cache = config('cache'); $cache['stores']['file']['path'] = $this->app->getRuntimePath().'cache'.DIRECTORY_SEPARATOR.'test'; config(['cache' => $cache]); }
经过测试: 修改了文件系统配置后,上传文件会存放到public/storage/test目录中; 修改了缓存配置后,通过Cache::set()方法设置缓存,缓存并没有存放到runtime/cache/test目录中,但打印Cache::getConfig()和Cache::getStoreConfig('file')方法确实可以得到修改后的配置值。
public/storage/test
Cache::set()
runtime/cache/test
Cache::getConfig()
Cache::getStoreConfig('file')
问题: 如何动态修改缓存配置并使其生效?
非常感谢。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
版本:ThinkPHP v6.0.12
我定义了一个
service
,在boot()
或者register()
方法中使用如下代码动态修改配置信息,会出现部分修改后的配置不生效的问题,代码如下:经过测试:
修改了文件系统配置后,上传文件会存放到
public/storage/test
目录中;修改了缓存配置后,通过
Cache::set()
方法设置缓存,缓存并没有存放到runtime/cache/test
目录中,但打印Cache::getConfig()
和Cache::getStoreConfig('file')
方法确实可以得到修改后的配置值。问题:
如何动态修改缓存配置并使其生效?
非常感谢。
The text was updated successfully, but these errors were encountered: