🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
php ``` public function shandianfu(){ // 全局设置 $uid = $this->user->id; //获取用户UID $biao = Db::name('user_shandianfu')->where(['user_id' => $uid])->find(); //查表 $info = unserialize($biao['info']); //反序列化获取表单参数 // 提交表单 if ($this->request->isPost()) { $post_get = $this->request->post(''); //获取提交的参数 $data['info'] = serialize($post_get); //将提交的参数值序列化 // 修改数据 if ($biao['user_id']){ $sql_xr = Db::name('user_shandianfu')->where(["user_id" => $uid])->update($data); // 创建数据 }else{ $addup = [ 'user_id' => $uid, //用户ID 'create_at' => time(), //创建时间 'info' => $data['info'], //表单参数 ]; $sql_xr = Db::name('user_shandianfu')->insertGetId($addup); } // 写入反馈 if ($sql_xr) { $this -> success('操作成功'); }else{ $this -> error('操作失败'); } } // 给模版传递变量 $this->assign([ 'z_title' => "闪电付配置", 'biao' => $biao, 'info' => $info, ]); // 设置模版 return $this->fetch(); } ``` html ``` <form class="form-horizontal" method="post" id="gathering_sdfcs"> <div class="collect_type type_bank"> <div class="form-group row"> <label class="col-md-2 col-form-label">开户银行</label> <div class="col-md-6"> <input name="bank_name" type="text" class="form-control" value="{$info['bank_name']|default=''|htmlentities}" placeholder="如:建设银行" > </div> </div> <div class="form-group row"> <label class="col-md-2 col-form-label">银行地址</label> <div class="col-md-6"> <input name="bank_branch" type="text" class="form-control" value="{$info['bank_branch']|default=''|htmlentities}" placeholder="如:建设银行安阳林州支行" > </div> </div> <div class="form-group row"> <label class="col-md-2 col-form-label">银行卡号</label> <div class="col-md-6"> <input name="bank_card" type="text" class="form-control" value="{$info['bank_card']|default=''|htmlentities}" placeholder="如:123456" > </div> </div> <div class="form-group row"> <label class="col-md-2 col-form-label">真实姓名</label> <div class="col-md-6"> <input name="realname" type="text" class="form-control" value="{$info['realname']|default=''|htmlentities}" placeholder="如:张三"> </div> <div class="col-md-4 d-flex align-items-center"> <p class="text-muted mb-0">必须同银行卡持有人一致</p> </div> </div> <div class="form-group row"> <label class="col-md-2 col-form-label">身份证号码</label> <div class="col-md-6"> <input name="idcard_number" type="text" class="form-control" value="{$info['idcard_number']|default=''|htmlentities}" placeholder="如:410521199203113013"> </div> <div class="form-mid word-aux"></div> </div> </div> <div class="form-group row"> <label class="col-md-2 col-form-label"></label> <div class="col-md-6 text-center"> <button type="submit" class="btn btn-primary waves-effect waves-light">保存设置</button> </div> </div> </form> ```