极速快三

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

    <code id='6bRP4a'><strong id='6bRP4a'></strong></code>

    <fieldset id='6bRP4a'></fieldset>
          <span id='6bRP4a'></span>

              <ins id='6bRP4a'></ins>
              <acronym id='6bRP4a'><em id='6bRP4a'></em><td id='6bRP4a'><div id='6bRP4a'></div></td></acronym><address id='6bRP4a'><big id='6bRP4a'><big id='6bRP4a'></big><legend id='6bRP4a'></legend></big></address>

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

                待发短信

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

                4001-021-502

                工作时间

                9:00-21:00

                WeCenterV4.0.1新增短信宝※短信接口

                WeCenter是一№款知识型的社交化问答开源社区程序,专注于企业和行业社区内容的整理、归类、检索和再发行。 是中国首个基于 PHP + MYSQL 开发的开源化社交问答社区。今天小编为大家讲解weCenter_3.19版本的短↓信接口替换◥,使用的接口是我们短信宝群发平台的短信接口,我们短信宝群发短信平台非常稳↘定,发送速度快,注册还送测试短信,推荐『大家使用。
                1:打开项目:app\frontend\Account.php 修改短信开关方法 大概在179行

                1
                2
                3
                4
                $register_type = $this->settings['register_type'];
                if (($register_type == 'mobile' || $register_type == 'all') && !(get_plugins_config('sms','base') && get_plugins_config('sms','base')!='N')) {
                    $this->error('网站尚未安装或配置短信插件', (string) url('account/register'));
                }

                2:打开项目:plugins目录增加smsbao插件目录

                1
                2
                3
                4
                5
                6
                7
                - 目录结构如下
                - smsbao
                -- config.php基本配置信息
                -- info.php是插件的■说明、配置、菜单信息
                -- Plugin.php 短信发送函数
                -- install.sql 安装插件时数据库操作脚本
                -- uninstall.sql 卸载插件时数据库操作脚本

                3:下面具体给大家说ㄨ短信发送代码 打开plugins\Plugin.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
                77
                78
                79
                80
                81
                82
                83
                <?php
                namespace plugins\smsbao;
                use app\common\controller\Plugins;
                use think\facade\Cache;
                class Plugin extends Plugins
                {
                    /**
                     * 安装前的业务处理,可在◥此方法实现,默认返回true
                     */
                    public function install()
                    {
                        return true;
                    }
                    /**
                     * 卸载♂前的业务处理,可在此方法实现,默认返回true
                     */
                    public function uninstall()
                    {
                        return true;
                    }
                    public function enable()
                    {
                        return true;
                    }
                    public function disable()
                    {
                        return true;
                    }
                    public function sms($param=[])
                    {
                        $smsConfig = $this->getConfig();
                        if($smsConfig['base']['enable']=='N')
                        {
                            return json_encode(['code'=>0,'msg'=>'短信功能未启用'], JSON_UNESCAPED_UNICODE);
                        }
                        //短信ぷ宝短信
                        if($smsConfig['base']['enable']=='smsbao')
                        {
                            $sms_user = $smsConfig['smsbao']['sms_user'];
                            $sms_pwd = md5($smsConfig['smsbao']['sms_pwd']);
                            // 签名
                            $smsSign = $smsConfig['smsbao']['SignName'];
                            // 模板
                            $template = $smsConfig['smsbao']['TemplateCode'];
                            $statusStr = array(
                                "0" => "短信发送▓成功",
                                "-1" => "参数不全",
                                "-2" => "服务器空间不支持,请确认支】持curl或者fsocket,联系您「的空间商解决或者更换空间!",
                                "30" => "密码错误",
                                "40" => "账号不存在",
                                "41" => "余额不足",
                                "42" => "帐户已过期",
                                "43" => "IP地址限制",
                                "50" => "内容含有敏感@ 词"
                            );
                            try {
                                /* 模板参数: 若无模板参数,则设置为空*/
                                $code = rand(100000,999999);
                                $cache_code = Cache::get('sms_'.$param['mobile']);
                                // 通过 client 对象调用 SendSms 方法发起请╲求。注意请求方法名与请求对象是对应的
                                if(!$cache_code) {
                                    //发送短信
                                    $smsapi = "";
                                    $content='【'.$smsSign.'】'.str_replace('{$code}',$code,$template);//要发送的短信内容
                                    $phone = $param['mobile'];//要发送短信的手机号码
                                    $sendurl = $smsapi."sms?u=".$sms_user."&p=".$sms_pwd."&m=".$phone."&c=".urlencode($content);
                                    $result =file_get_contents($sendurl) ;
                                    if ($result == '0') {
                                        Cache::set('sms_'.$param['mobile'],$code,60*5);
                                        return json_encode(['code' => 1, 'msg' => '短信发送成功'], JSON_UNESCAPED_UNICODE);
                                    else {
                                        return json_encode(['code' => 0, 'msg' => $statusStr[$result]], JSON_UNESCAPED_UNICODE);
                                    }
                                }
                                return json_encode(['code'=>0,'msg'=>'验证码5分钟内有效,请□ 使用收到验证码进行填写'],JSON_UNESCAPED_UNICODE);
                            }
                            catch(\Exception $e) {
                                return json_encode(['code'=>0,'msg'=>$e->getMessage()], JSON_UNESCAPED_UNICODE);
                            }
                        }
                        return false;
                    }
                }

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

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

                另外:我们已经开发好完整的WeCenterV4.0.1系统短◥信宝插件,点击此链接?下载及查看安装流程。

                开源插件

                最新更新

                电商类

                CMS类

                微信类

                文章标签