如何使用本地控制台配置文件覆盖Yii Framework的config / console.php?(How Override Yii Framework's config/console.

编程入门 行业动态 更新时间:2024-10-28 15:21:43
如何使用本地控制台配置文件覆盖Yii Framework的config / console.php?(How Override Yii Framework's config/console.php with Local Console Configuration File?)

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?

最满意答案

嗯,这是一个有趣的方式来覆盖配置。 但看起来您可以像修改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).

更多推荐

本文发布于:2023-08-03 15:27:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1395045.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控制台   如何使用   配置文件   Framework   config

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!