Take the yii2 framework as an example:
The timing configuration file console\config\params.php
is configured as follows:
< /p>
Question:
1. Get the timing of the red box in the above picture from the database. When encountering
`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`
Error, how to solve it?
2. How to obtain database data in params.php of yii2?
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).