91成人在线播放_欧美一区二区视频在线观看_91精品国产高清久久久久久_国产精品久久亚洲不卡4k岛国


待發(fā)短信

在線客服
產(chǎn)品支持 短信寶客服
合作渠道 渠道合作
服務(wù)咨詢

4001-021-502

工作時(shí)間

9:00-21:00

大米cms_v6新增短信寶短信接口

大米CMS(又名3gcms)是一個(gè)免費(fèi)開源、快速、簡單的PC建站和手機(jī)建站集成一體化系統(tǒng), 致力于為用戶提供簡單、快捷的PC建站和智能手機(jī)建站解決方案。小編對他還是比較了解的,今天小編就以新增短信接口為例,給大家講解一下如何進(jìn)行二次開發(fā),我們今天講解的是V6版本,使用的短信接口是我們短信寶短信群發(fā)平臺的短信接口,我們短信寶短信群發(fā)平臺的接口非常穩(wěn)定,發(fā)送速度快,注冊就送測試短信,推薦大家使用。

首先打開項(xiàng)目:\Admin\Tpl\default\Config\index.html 在38行增加下代碼

?
1
2
3
4
5
6
7
8
9
<ul class="nav nav-tabs">
                    <li style="width:100px;"><a data-toggle="tab"></a></li>
                    <li class="active"><a href="#total_config" data-toggle="tab">網(wǎng)站整體配置</a></li>
                    <li><a href="#home_config" data-toggle="tab">首頁配置</a></li>
                    <li><a href="#list_config" data-toggle="tab">列表頁配置</a></li>
                    <li><a href="#content_config" data-toggle="tab">內(nèi)容頁配置</a></li>
                    <li><a href="#mail_config" data-toggle="tab">郵件發(fā)送配置</a></li>
                   <li><a href="#sms_config" data-toggle="tab">短信發(fā)送配置</a></li>
              </ul>

同時(shí)增加下短信配置

?
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
<div class="tab-pane" id="sms_config">
            <div id="myTab1_Content3" style="clear:both;">
                <table width="100%" border="0"  align=center cellpadding="3" cellspacing="1" style="margin:5px 0;background:#FFF">
 
 
                    <tr onMouseOver="this.style.backgroundColor='#EEFCDD';this.style.color='red'" onMouseOut="this.style.backgroundColor='';this.style.color=''">
                        <td width="40%" align="right">短信寶賬號:                </td>
                        <td align="center">&nbsp;</td>
                        <td width="60%" align="left">
                            <input name="SMS_FROM" type="text" id="MAIL_FROM" onFocus="hSiteTitle.style.color='blue';" onBlur="hSiteTitle.style.color='#ccc';" value="" style="width:300px;">
                            還沒有注冊短信寶賬號?<a href="HTTP://www.gjrencai.com/register.jhtml" target="_blank" style="color: red;">立即注冊</a>
                        </td>
                    </tr>
 
 
                    <tr onMouseOver="this.style.backgroundColor='#EEFCDD';this.style.color='red'" onMouseOut="this.style.backgroundColor='';this.style.color=''">
                        <td width="40%" align="right">短信寶密碼:                </td>
                        <td align="center">&nbsp;</td>
                        <td width="60%" align="left"><input name="SMS_PASSSWORD" type="password" id="MAIL_PASSSWORD" onFocus="hSiteTitle.style.color='blue';" onBlur="hSiteTitle.style.color='#ccc';" value="" style="width:300px;"></td>
                    </tr>
                    <tr onMouseOver="this.style.backgroundColor='#EEFCDD';this.style.color='red'" onMouseOut="this.style.backgroundColor='';this.style.color=''">
                        <td width="40%" align="right">短信寶簽名:                </td>
                        <td align="center">&nbsp;</td>
                        <td width="60%" align="left"><input name="SMS_SING" type="text" id="MAIL_PASSSWORD" onFocus="hSiteTitle.style.color='blue';" onBlur="hSiteTitle.style.color='#ccc';" value="" style="width:300px;"></td>
                    </tr>
                    <tr class="css_page_list">
                        <td height="30" colspan=3 align="center">
                            <input type="hidden" name="id" value="{$list.id}"/>
                            <input name='Submit' type='submit' class="btn btn-success" value=' 保存設(shè)置 '></td>
                    </tr>
                </table>
            </div>
        </div>

打開項(xiàng)目:\Admin\Lib\Action\ConfigAction.class.php 新增下代碼

?
1
2
3
  $configStr = preg_replace("/'SMS_FROM'=>'.*'/","'SMS_FROM'=>'".htmlspecialchars($_POST['SMS_FROM'],ENT_QUOTES)."'",$configStr);
        $configStr = preg_replace("/'SMS_SING'=>'.*'/","'SMS_SING'=>'".htmlspecialchars($_POST['SMS_SING'],ENT_QUOTES)."'",$configStr);
        if(C('SMS_PASSSWORD') != $_POST['SMS_PASSSWORD']){$configStr = preg_replace("/'SMS_PASSSWORD'=>'.*'/","'SMS_PASSSWORD'=>'".$_POST['SMS_PASSSWORD']."'",$configStr);}

打開項(xiàng)目:\Web\Common\common.php 修改發(fā)送短信類

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 function send_smsmess($to_mobile,$content,$isvail=0){
    $smsapi "http://api.smsbao.com/";
    if($isvail==1){
        $config = F('basic''''./Web/Conf/');
        $mobile_code = mt_rand(1000,9999);
        $content "您的驗(yàn)證碼是:".$mobile_code."。請不要把驗(yàn)證碼泄露給其他人。";
    }
    $user = C('SMS_FROM'); //短信平臺帳號
    $pass = md5(C('SMS_PASSSWORD')); //短信平臺密碼
    $content='【'.C('SMS_SING').'】'.$content;//要發(fā)送的短信內(nèi)容
    $phone $to_mobile;//要發(fā)送短信的手機(jī)號碼
    $sendurl $smsapi."sms?u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content);
    $result =file_get_contents($sendurl) ;
    //$data = ("account=".C('SMS_FROM')."&password=".C('SMS_PWD')."&mobile=".$to_mobile."&content=".rawurlencode($content));//短信用戶名與密碼請?jiān)谶@里改
   //密碼可以使用明文密碼或使用32位MD5加密
    //$gets =  xml_to_array(SPost($data, $target));
    //var_dump($gets);
    if($result==0 && $isvail==1){
        $_SESSION['mobile_verify'] = md5($mobile_code);
    }
    return $result;
}

打開項(xiàng)目:\Public\Config\config.ini.php開啟短信配置

?
1
'MOBILE_VERIFY'=>'1',//手機(jī)短信驗(yàn)證碼

經(jīng)過上面的替換,短信寶的短信平臺已經(jīng)替換成功了,可以正常使用了。

報(bào)備一下短信寶的VIP模板,這樣就可以走短信寶的優(yōu)質(zhì)通道了,即便遇到敏感文字我們都不會人工審核,短信內(nèi)容3~5秒就可送達(dá)。

另外:我們已經(jīng)開發(fā)好完整的大米cms_v6系統(tǒng)短信寶插件,點(diǎn)擊此鏈接 下載及查看安裝流程。

開源插件

最新更新

電商類

CMS類

微信類

文章標(biāo)簽