Record of a TikTok E-commerce Order Program Amount Modification Not Taking Effect on Frontend Issue – Developed with FastAdmin
A TikTok order program modification where the frontend doesn’t reflect the changes. FastAdmin development – need to click “Clear Cache” here after every modification. It seems the configuration file update isn’t taking effect. This might be due to ThinkPHP’s configuration cache. Let’s solve it through the following steps:
First, confirm the configuration file location and content are correctly modified:
“`php
// In application/config.php or config/config.php
return [
‘recharge_money_list’ => ‘3610/5000/10000/30000/50000/100000’,
// Other configurations…
];
“`
Force update the configuration in the controller:
“`php
public function recharge()
{
// Force set new configuration
\think\Config::set(‘recharge_money_list’, ‘3610/5000/10000/30000/50000/100000’);
// Clear cache
\think\Cache::clear();
// Print to check configuration
dump(config(‘recharge_money_list’));
// Original code…
$uid = session(‘user_id’);
$this->userInfo = $userInfo = Db::name(‘xy_users’)->where(‘id’, $uid)->field(‘tel,balance,level,all_recharge_num’)->find();
// …other code
}
“`
Or directly override the configuration in the controller:
“`php
public function recharge()
{
$money_list = ‘3610/5000/10000/30000/50000/100000’;
$list = explode(‘/’, $money_list);
$this->assign(‘list’, $list);
// Original code…
$uid = session(‘user_id’);
$this->userInfo = $userInfo = Db::name(‘xy_users’)->where(‘id’, $uid)->field(‘tel,balance,level,all_recharge_num’)->find();
// …
}
“`
If it still doesn’t work, you can try:
– Delete cache files under the runtime directory
– Restart the PHP service
– Check if there are other places overriding this configuration
In the template, you can first print to check the data:
“`html
{dump $list}
{foreach $list as $v}
{/foreach}
“`
If it’s a production environment, you also need:
“`bash
# Clear opcache cache
php -r “opcache_reset();”
# Restart php-fpm
service php-fpm restart
“`
-
Alipay QR Code Scan
-
WeChat Scan Pay