如何使用本地控制台配置文件覆盖 Yii 框架的 config/console.php?
Yii 框架的 config/main.php 文件 可以通过 array_merge 被 local.php 配置文件覆盖。这允许我设置不同的数据库连接和特定于生产、QA 和开发环境的其他参数。
Yii 还允许我在命令行中运行命令。它使用 config/console.php 文件。有没有一种方法可以以相同的方式设置本地控制台配置文件,从而根据环境覆盖主控制台配置?
Yii framework's config/main.php file can be overwritten by a local.php configuration file via an array_merge. This allows me to set different database connections and other parameters specific to production, QA, and development environments.
Yii also allows me to run commands in the command line. It uses a config/console.php file. Is there a way I can set up a local console config file in the same way that will override the main console config depending on the environment?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,这是一种覆盖配置的有趣方法。但看起来你可以像修改 main.php 一样修改 console.php (将 local_config 函数添加到 console.php 并将其指向 console-local.php)。
Hmm, that's an interesting way of doing overriding the config. But it looks like you could just modify console.php in the same way you did the main.php (add local_config function to console.php and point it to console-local.php).