为了方便开发者开发,进云插件支持统一设置插件默认参数,设置好后,在调用plugin_setting函数获取插件配置参数时,系统会自动获取相应默认参数,然后利用默认参数将未设置的参数字段初始化一个默认值!
默认参数的声明方法为,在插件根目录下创建一个default_setting.php文件,该文件返回一个默认参数数组,键名是调用plugin_setting时的参数$key,键值是相应key对应的默认参数内容!
通过此方法,可以省去开发者零散杂乱的初始化默认参数的工作,更加专注与业务实现!
示例代码:
下面是微客分销插件的默认参数设置代码
return array( 'setting'=>array( 'level'=>'3', 'self_commission'=>'0', 'become_child'=>'1', 'become'=>'0', 'num'=>1, 'money'=>100.00, 'become_check'=>'0', 'become_reg'=>'0', 'balance_money'=>0, 'balance_per'=>0, 'commissiontype'=>1, 'balance_money_start'=>1, 'balance_money_end'=>100, 'balance_day'=>0, 'level_up_types'=>';member_num;agent_num;order_price;order_num;order_price_next;order_num_next;member_num_next;agent_num_next;', ), 'page_setting'=>array( 'qrcodeshare'=>1, 'myshop'=>1, 'select_goods'=>1, 'tcommission1'=>'分销佣金', 'tcommission'=>'佣金', 'tcommission_detail'=>'结算明细', 'commission_total'=>'累计佣金', 'commission_0'=>'待收货佣金', 'commission_1'=>'待结算佣金', 'commission_1_1'=>'可结算佣金', 'balance_total'=>'已结算佣金', 'balance_1'=>'待打款佣金', 'balance_2'=>'无效佣金', 'balance_3'=>'已打款佣金', 'balance_pay'=>'扣除提现手续费', 'torder'=>'分销订单', 'tagent'=>'分销商', 'tshop'=>'小店', 'tmyshop'=>'我的小店', 'tcenter'=>'分销中心', 'tbecome'=>'成为分销商', 'balance_button'=>'结算', 'tdown'=>'下线', 'tmydown'=>'我的下线', 'applytitle'=>'代理加盟协议', 'applycontent'=>'代理协议内容', ),); |