步骤
进入网站根目录,编辑/app/Services/Config.php
文件,在
"enable_telegram" => self::get("enable_telegram")
后添加一个英文逗号,变成
"enable_telegram" => self::get("enable_telegram"),
然后添加一行
"enable_bought_reset" => self::get("enable_bought_reset")
变成
public static function getPublicConfig() { return [ "appName" => self::get("appName"), "version" => VERSION, "baseUrl" => self::get("baseUrl"), "checkinMin" => self::get("checkinMin"), "code_payback" => self::get("code_payback"), "checkinMax" => self::get("checkinMax"), "wecenter_url" => self::get("wecenter_url"), "enable_wecenter" => self::get("enable_wecenter"), "jump_delay" => self::get("jump_delay"), "enable_analytics_code" => self::get("enable_analytics_code"), "enable_donate" => self::get("enable_donate"), "enable_telegram" => self::get("enable_telegram"), "enable_bought_reset" => self::get("enable_bought_reset") ]; }
然后编辑/resources/views/material/user/shop.tpl
文件,在适当的地方添加提示语和判断语句
{if $config['enable_bought_reset'] == 'true'} <div class="card"> <div class="card-main"> <div class="card-inner"> <p><font size="4" color="red">温馨提示:通过“自助商店”续费后,您的账户剩余流量会重置为套餐内容,不会叠加</font></p> </div> </div> </div> {/if}
效果
就不上图了。当Confi.php
的enable_bought_reset
设为true
时,提示语会显示;设为false
时,则不会显示。本文也提供了一个思路,即当Confi.php
的某个变量被设为某个值时,而你又想根据不同的值在前端显示不同的提示语句,就可以参考本文的思路和过程来实现
发表回复