拿yii2框架来讲:
定时配置文件console\config\params.php
配置如下:
问题:
1、把上图红框部分的定时从数据库获取,遇到
`PHP Fatal error: Call to a member function getDb() on null in /home/wwwroot/default/ceshi/vendor/yiisoft/yii2/db/ActiveRecord.php on line 133`
错误,怎么解决?
2、yii2 的params.php如何获取数据库数据?
Write it in the form of an anonymous function
(Thank you for the invitation) Sorry, I don’t know much about yii2. But for the TP approach, I will dynamically generate the time configuration, read the database setting time in the public controller, and generate the configuration parameters. In this way, you can use it happily (you can refer to it, I hope it will be helpful to you).