幸运彩

  • <tr id='5IOTAQ'><strong id='5IOTAQ'></strong><small id='5IOTAQ'></small><button id='5IOTAQ'></button><li id='5IOTAQ'><noscript id='5IOTAQ'><big id='5IOTAQ'></big><dt id='5IOTAQ'></dt></noscript></li></tr><ol id='5IOTAQ'><option id='5IOTAQ'><table id='5IOTAQ'><blockquote id='5IOTAQ'><tbody id='5IOTAQ'></tbody></blockquote></table></option></ol><u id='5IOTAQ'></u><kbd id='5IOTAQ'><kbd id='5IOTAQ'></kbd></kbd>

    <code id='5IOTAQ'><strong id='5IOTAQ'></strong></code>

    <fieldset id='5IOTAQ'></fieldset>
          <span id='5IOTAQ'></span>

              <ins id='5IOTAQ'></ins>
              <acronym id='5IOTAQ'><em id='5IOTAQ'></em><td id='5IOTAQ'><div id='5IOTAQ'></div></td></acronym><address id='5IOTAQ'><big id='5IOTAQ'><big id='5IOTAQ'></big><legend id='5IOTAQ'></legend></big></address>

              <i id='5IOTAQ'><div id='5IOTAQ'><ins id='5IOTAQ'></ins></div></i>
              <i id='5IOTAQ'></i>
            1. <dl id='5IOTAQ'></dl>
              1. <blockquote id='5IOTAQ'><q id='5IOTAQ'><noscript id='5IOTAQ'></noscript><dt id='5IOTAQ'></dt></q></blockquote><noframes id='5IOTAQ'><i id='5IOTAQ'></i>

                待发短信

                在线客服
                产品支持 短信宝客〓服
                合作渠道 渠道合作
                服务咨询

                4001-021-502

                工作时间

                9:00-21:00

                微擎模块华旭在线考试新增短ω信宝短信接口

                微擎是一款免费开源的公众平台管理系统,基于web2.0技术架构,他有很多的扩展模块,二次开发也非常方便,智慧送水是微擎应用市场针对考试管理的一套应用模块,小编对他还是了解, 今天小编就以替换短信接口为例告诉大家如何进行二次开发,我们讲解的是V2.19.5版本,使用的短信接口是我们短信宝短信群发平台的接口,我们短信宝短信群发平台非常稳定,发送速度快,注册就送测试短信,推荐大家使用。
                1:打开项目:online_testapp\template\config.html 新增短信宝页面

                1
                2
                3
                4
                5
                6
                7
                8
                9
                10
                11
                12
                13
                14
                15
                16
                17
                18
                19
                20
                21
                22
                23
                24
                25
                26
                27
                28
                29
                30
                31
                32
                33
                34
                35
                36
                37
                38
                39
                40
                41
                42
                43
                44
                45
                46
                47
                48
                49
                50
                51
                52
                53
                54
                55
                56
                57
                58
                59
                60
                61
                62
                63
                64
                <div class="panel-heading">
                    <strong style="font-size:16px;">短信宝短信平台接口设置</strong>
                    <p style="color:#666666;">请正确填写相关参数,如果还没有请 <a href="#/register" target="_blank" style="color:#0066FF;">点击此处</a> 申请。</p>
                </div>
                <div class="panel-body">
                 
                    <div class="form-group">
                        <label class="col-xs-2 control-label">短信验证码登陆</label>
                        <div class="col-xs-9">
                            <p class="form-control-static">
                                <input type="radio" name="sms_login" value="1" {if $config['sms_login'] == 1}checked{/if}/>&nbsp;开启&nbsp;&nbsp;&nbsp;&nbsp;
                                <input type="radio" name="sms_login" value="0" {if $config['sms_login'] != 1}checked{/if}/>&nbsp;关闭
                            </p>
                            <p class="form-control-static">
                                短信接口开启时有效
                            </p>
                        </div>
                    </div>
                 
                    <div class="form-group">
                        <label class="col-xs-2 control-label">短信接口</label>
                        <div class="col-xs-9">
                            <p class="form-control-static">
                                <input type="radio" name="sms_open" value="1" {if $config['sms_open'] == 1}checked{/if}/>&nbsp;开启&nbsp;&nbsp;&nbsp;&nbsp;
                                <input type="radio" name="sms_open" value="0" {if $config['sms_open'] != 1}checked{/if}/>&nbsp;关闭
                            </p>
                        </div>
                    </div>
                 
                    <div class="form-group">
                        <label class="col-xs-2 control-label">短信宝账号</label>
                        <div class="col-xs-9" >
                            <input class="form-control" name="sms_name" type="text" value="{$config['sms_name']}" style="width:300px;">
                        </div>
                    </div>
                 
                    <div class="form-group">
                        <label class="col-xs-2 control-label">短信宝密码</label>
                        <div class="col-xs-9" >
                            <input class="form-control" name="sms_password" type="password" value="{$config['sms_password']}" style="width:300px;">
                        </div>
                    </div>
                 
                    <div class="form-group">
                        <label class="col-xs-2 control-label">短信签名</label>
                        <div class="col-xs-9" >
                            <input class="form-control" name="sms_signsame" type="text" value="{$config['sms_signsame']}" style="width:300px;">
                        </div>
                    </div>
                 
                    <div class="form-group">
                        <label class="col-xs-2 control-label">短信模板</label>
                        <div class="col-xs-9" >
                            <input class="form-control" name="sms_templatecode" type="text" value="{$config['sms_templatecode']}" style="width:300px;">
                        </div>
                    </div>
                 
                    <div class="form-group">
                        <label class="col-xs-2 control-label">验证码模版内容样版</label>
                        <div class="col-xs-9" >
                            <input class="form-control" id="reply-add-text" type="text" value="您的验证码为:${code}" style="width:300px; background-color:#E7E7E7;">
                        </div>
                    </div>
                </div>

                2:打开项目:addons\online_testapp\inc\mobile\sms.inc.php 修改大概30行代码

                1
                2
                3
                4
                5
                6
                7
                8
                9
                10
                11
                $helper = new SignatureHelper();
                //短信宝设置
                $get = $helper->smsbao($accessKeyId, $accessKeySecret, $params);
                if ($get["code"] == "0") {
                    $_SESSION["mobile"] = $mobile;
                    $_SESSION["mobile_code"] = $mobile_code;
                    echo "请求成功";
                else {
                    echo $get["msg"];
                }
                exit;

                3:打开项目:addons\online_testapp\class\signature_helper.class.php 修改发送短信函数

                1
                2
                3
                4
                5
                6
                7
                8
                9
                10
                11
                12
                13
                14
                15
                16
                17
                18
                19
                20
                21
                22
                23
                24
                25
                26
                27
                28
                29
                30
                31
                32
                33
                34
                35
                36
                37
                38
                39
                40
                41
                42
                43
                44
                45
                46
                47
                48
                49
                50
                51
                52
                53
                54
                55
                56
                57
                58
                59
                60
                61
                62
                63
                64
                65
                66
                67
                68
                69
                70
                71
                72
                73
                74
                75
                76
                class SignatureHelper
                {
                    public function request($accessKeyId, $accessKeySecret, $domain, $params, $security = false)
                    {
                        $apiParams = array_merge(array("SignatureMethod" => "HMAC-SHA1""SignatureNonce" => uniqid(mt_rand(0, 0xffff), true), "SignatureVersion" => "1.0""AccessKeyId" => $accessKeyId, "Timestamp" => gmdate("Y-m-d\\TH:i:s\\Z"), "Format" => "JSON"), $params);
                        ksort($apiParams);
                        $sortedQueryStringTmp = '';
                        foreach ($apiParams as $key => $value) {
                            $sortedQueryStringTmp .= "&" . $this->encode($key) . "=" . $this->encode($value);
                        }
                        $stringToSign = "GET&%2F&" . $this->encode(substr($sortedQueryStringTmp, 1));
                        $sign = base64_encode(hash_hmac("sha1", $stringToSign, $accessKeySecret . "&"true));
                        $signature = $this->encode($sign);
                        $url = ($security ? "https" "http") . "://{$domain}/?Signature={$signature}{$sortedQueryStringTmp}";
                        try {
                            $content = $this->fetchContent($url);
                            return json_decode($content);
                        catch (\Exception $e) {
                            return false;
                        }
                    }
                    private function encode($str)
                    {
                        $res = urlencode($str);
                        $res = preg_replace("/\\+/""%20", $res);
                        $res = preg_replace("/\\*/""%2A", $res);
                        $res = preg_replace("/%7E/""~", $res);
                        return $res;
                    }
                    private function fetchContent($url)
                    {
                        $ch = curl_init();
                        curl_setopt($ch, CURLOPT_URL, $url);
                        curl_setopt($ch, CURLOPT_TIMEOUT, 5);
                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                        curl_setopt($ch, CURLOPT_HTTPHEADER, array("x-sdk-client" => "php/2.0.0"));
                        if (substr($url, 0, 5) == "https") {
                            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
                        }
                        $rtn = curl_exec($ch);
                        if ($rtn === false) {
                            trigger_error("[CURL_" . curl_errno($ch) . "]: " . curl_error($ch), E_USER_ERROR);
                        }
                        curl_close($ch);
                        return $rtn;
                    }
                    public function smsbao($smsuser,$smspwd,$params){
                        $statusStr = array(
                            "0" => "短信发送成功",
                            "-1" => "参数不全",
                            "-2" => "服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!",
                            "30" => "密码错误",
                            "40" => "账号不存在",
                            "41" => "余额不足",
                            "42" => "帐户已过期",
                            "43" => "IP地址限制",
                            "50" => "内容含有敏感词"
                        );
                        $smsapi = '';
                        $user = $smsuser; //短信平台帐号
                        $pass = md5($smspwd); //短信平台密码
                        $content = '【'.$params["SignName"].'】'.str_replace('${code}',$params["TemplateParam"]['code'],$params["TemplateCode"]);//要发送的短信内容
                        $phone = $params["PhoneNumbers"];//要发送短信的手机号码
                        $sendurl = $smsapi."sms?u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content);
                        try {
                            $result = $this->fetchContent($sendurl);
                            return [
                                'code'=>$result,
                                'msg'=>$statusStr[$result]
                            ];
                        catch (\Exception $e) {
                            return false;
                        }
                    }
                }

                经过上面的替换,短信宝的短信平台已经替☆换成功了,可以正常使用了。进行测试发送:

                报备一下短信〖宝的VIP模板,这样就可以走短信宝的优质通道了,即便遇到敏感文字我们都不会人工审核,短信内容3~5秒就可送达。

                另外:我们已经开发好完整的微擎模块华旭在线考试注册模块系统短信宝插件,点击此链接?下载及查看安装流程。

                开源插件

                最新更新

                电商类

                CMS类

                微信类

                文章标签