php Laravel 5.3 - 清除共享主机中的配置缓存

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41521837/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 02:24:18  来源:igfitidea点击:

Laravel 5.3 - Clear config cache in shared hosting

phplaravelcaching

提问by Wahyu Handy

Currently I'm working on small project that require me to host my laravel app on shared hosting (please ignore the reason why I didn't use VPS to host my laravel project) and this hosting provider disable escapeshellarg() for security reason so I can't use php artisan config:cacheto clear config cache.

目前我正在做一个小项目,需要我在共享主机上托管我的 Laravel 应用程序(请忽略我没有使用 VPS 来托管我的 Laravel 项目的原因)并且这个托管服务提供商出于安全原因禁用了 escapeshellarg() 所以我不能php artisan config:cache用来清除配置缓存。

Is there any workaround for this?

有什么解决方法吗?

回答by Alexey Mezenin

config:clearcommand just deletes bootstrap/cache/config.phpfile, so just delete this file manually.

config:clear命令只是删除bootstrap/cache/config.php文件,因此只需手动删除此文件。

回答by 321zeno

You can call artisan commands programmatically

您可以以编程方式调用工匠命令

Artisan::call('config:clear');

This can be helpful in setups where the PHP user has a different set of permissions than the FTP user (so files created by PHP cannot be deleted via FTP)

这在 PHP 用户与 FTP 用户具有不同权限集的设置中很有帮助(因此 PHP 创建的文件无法通过 FTP 删除)

回答by Developer

Try also

也试试

for command line

对于命令行

php artisan config:cache

using artisan commands

使用工匠命令

\Artisan::call('config:clear');

https://www.tutsmake.com/laravel-clear-cache-using-artisan-command-cli/

https://www.tutsmake.com/laravel-clear-cache-using-artisan-command-cli/