迅睿CMS框架是一款PHP8高性能·简单易用的CMS开源开发框架,基于MIT开源许可协议发布,免费且不限制商业使用,是免费开源的产品,以万端互联为设计理念,支持的微信公众号、小程序、APP客户端、移动端网站、PC网站等多终端式管理系统。
联系官方销售客服
1835022288
028-61286886
后台添加用户怎样支持添加自定义字段?
https://www.xunruicms.com/wenda/25519.html
有点类似这个
\Phpcmf\Service::M()->table('member_data')->where('id', $uid)->update($uid, $member_data);
// 保存附表内容 $status = \Phpcmf\Service::L('input')->post('status'); $member_data = []; $member_data['xsjl'] = isset($status['xsjl']) ? (string)$status['xsjl'] : ''; $member_data['address'] = isset($status['address']) ? (string)$status['address'] : ''; $member_data['liandong'] = isset($status['liandong']) ? (string)$status['liandong'] : ''; \Phpcmf\Service::M()->table('member_data')->update($rt['data']['id'], $member_data);
// 后台添加 public function add() { if (IS_AJAX_POST) { $post = \Phpcmf\Service::L('input')->post('data'); //$uid = intval(\Phpcmf\Service::L('input')->get('id')); if (empty($post['password'])) { $this->_json(0, dr_lang('密码必须填写'), ['field' => 'password']); } else { $rt = \Phpcmf\Service::M('member')->register((int)$post['groupid'], [ 'username' => (string)$post['username'], 'phone' => (string)$post['phone'], 'email' => (string)$post['email'], 'name' => (string)$post['name'], 'password' => dr_safe_password($post['password']), ]); if (!$rt['code']) { $this->_json(0, $rt['msg'], ['field' => $rt['data']['field']]); } // 保存附表内容 $status = \Phpcmf\Service::L('input')->post('status'); $member_data = $data[1] ? $data[1] : []; $member_data['address'] = isset($status['address']) ? (string)$status['address'] : 0; $member_data['xsjl'] = isset($status['xsjl']) ? (int)$status['xsjl'] : 0; $member_data['liandong'] = isset($status['liandong']) ? (int)$status['liandong'] : 0; \Phpcmf\Service::M()->table('member_data')->where('id', $uid)->update($uid, $member_data); } $this->_json(1, dr_lang('操作成功')); } \Phpcmf\Service::V()->assign([ 'form' => dr_form_hidden(), ]); \Phpcmf\Service::V()->display('member_add.html');exit; }
现在想添加1个新会员只添加这个新文员的,xsjl,address,liandong,字段,不要影响旧会员
现在想添加1个新会员只添加这个新文员的,xsjl,address,liandong,字段,不要影响旧会员
这一步的前面,打印下$uid试试
uid获取好像错了