zoukankan      html  css  js  c++  java
  • 微擎自定义回复规则

    使用说明:

    1、回复的内容还是需要自己建表存储起来;

    2、通过 Module.php 文件将回复内容相关的操作封装起来

    最终效果图:

    示例:

    1、module.php

    <?php
    /**
     * 
     * @url http://www.we7.cc/
     */
    defined('IN_IA') or exit('Access Denied');
    
    class Dayu_smsModule extends WeModule {
        const TABLE_REPLY = '表名';
    
        // 关键字回复页内容展示
        public function fieldsFormDisplay($rid = 0) {
            load ()->func ( 'tpl' );
            global $_W;
            $reply = pdo_get(self::TABLE_REPLY, array('uniacid' => $_W['uniacid']));
            include $this->template('form');
        }
    
        // 验证提交内容是否正确
        public function fieldsFormValidate($rid = 0) {
            global $_GPC;
            if (empty ($_GPC['title'])) {
                return '请先添加标题';
            }
            if (empty ($_GPC['description'])) {
                return '请先添加描述';
            }
            if (empty ($_GPC['icon'])) {
                return '图标不能为空';
            }
            return '';
        }
    
        // 提交关键字回复的内容
        public function fieldsFormSubmit($rid)
        {
            global $_GPC, $_W;
            $data = array(
                'rid' => $rid,
                'uniacid' => $_W['uniacid'],
                'title' => $_GPC['title'],
                'description' => $_GPC['description'],
                'icon' => $_GPC['icon'],
            );
            if (!empty(pdo_get(self::TABLE_REPLY, array('rid' => $rid, 'uniacid' => $_W['uniacid'])))) {
                pdo_update(self::TABLE_REPLY, $data, array('rid' => $rid, 'uniacid' => $_W['uniacid']));
            } else {
                $data['create_time'] = time();
                pdo_insert(self::TABLE_REPLY, $data);
            }
        }
    
        //规则删除时调用
        public function ruleDeleted($rid) {
            pdo_delete(self::TABLE_REPLY, array ('rid' => $rid));
        }
    }

    2、template/form.html

    <div class="panel panel-default">
        <div class="panel-heading">设置关键字回复 <span style="color: red">(确认后,务删除)</span></div>
        <div class="panel-body">
            <div class="form-group">
                <label for="title" class="control-label col-sm-2">标题</label>
                <div class="col-sm-9">
                    <input type="text" class="form-control" name="title" id="title" value="{$reply['title']}">
                </div>
            </div>
            <div class="form-group">
                <label for="description" class="control-label col-sm-2">描述</label>
                <div class="col-sm-9">
                    <input type="text" class="form-control" name="description" id="description" value="{$reply['description']}">
                </div>
            </div>
            <div class="form-group">
                <label for="icon" class="control-label col-sm-2">ICON</label>
                <div class="col-sm-9">
                    {php echo tpl_form_field_image('icon', $reply['icon'])}
                </div>
            </div>
        </div>
    </div>
  • 相关阅读:
    TLS1.3 认证和秘钥建立握手环节的分析
    使用华为云+GitHub搭建自己的博客
    TLS1.3 握手协议的分析
    Formal Analysis of the TLS Handshake Protocol -----论文整理
    TLS1.3 握手过程特性的整理
    TLS1.3 PPT 整理
    SSL/TLS 握手协议简述
    TLS握手秘钥套件分析
    Scyther-Compromise 协议形式化安全分析如何改进协议
    HTTP 协议部分常识简介
  • 原文地址:https://www.cnblogs.com/GetcharZp/p/12073332.html
Copyright © 2011-2022 走看看