I want to put the appid of the WeChat public account into a custom parameter in a configuration file, and then it can be called in any controller. If it is modified, the place where it is called will be modified.
I want to put the appid of the WeChat public account into a custom parameter in a configuration file, and then it can be called in any controller. If it is modified, the place where it is called will be modified.
config/param.php
Yii:$app->params['key'] key is your parameter key name
First put the parameters into the params.php file in the config directory, as follows:
<code>return [ 'key' => 'value', ];</code>
Then, when quoting, use:
<code>\Yii::$app->params['key']</code>
Note that it is params, not param.