ZKEYS系統是—WIN平臺下款免費的域名主機管理軟件!能夠提供實時的域名注冊,虛擬主機、彈性云計算開通與管理!小編對他還是比較了解的,今天小編就以新增短信接口為例,給大家講解一下如何進行二次開發,使用的短信接口是我們短信寶短信群發平臺的短信接口,我們短信寶短信群發平臺的接口非常穩定,發送速度快,注冊就送測試短信,推薦大家使用。
首先打開項目:\template\Admin\Zkeys\PC\Page\Setting\basic.html文件,替換2542~2537行代碼:
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 = "content-block" > < div class = "content-block-title" >短信通道一</ div > < table class = "inner-table edit-table" > < tbody > < tr > < th style = "width: 180px;" >通道:</ th > < td > < span class = "row-title" >注:為確保正常發送,請正確填寫短信寶的短信通道信息!還未注冊短信寶賬號的請點擊< a href = "http://www.gjrencai.com/reg" target = "_blabk" >免費注冊</ a ></ span > </ td > </ tr > < tr > < th >ApiId:</ th > < td > < input type = "text" name = "smgApiId" class = "input input-long" value = "{$smg.smgApiId}" /> 短信寶用戶名 </ td > </ tr > < tr > < th >密鑰(ApiKey):</ th > < td > < input type = "password" name = "smgApiKey" class = "input input-long" value = "{$smg.smgApiKey}" /> 短信寶密碼 </ td > </ tr > < tr > < th >簽名(Signature):</ th > < td >< input type = "text" name = "smgSignatureMd" class = "input input-long" value = "{$smg.smgSignatureMd}" /> 短信簽名</ td > </ tr > </ tbody > </ table > </ div > |
接著打開項目:\libs\Niaoyun\Common\Sms\EnInfo.class.php文件,替換send方法
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
|
public function send( $mobile , $content , $id = null) { $smsapi = $this ->config[ 'url' ]; $user = $this ->config[ 'apiId' ]; //短信平臺帳號 $pass = md5( $this ->config[ 'apiKey' ]); //短信平臺密碼 $content = $this ->config[ 'signature' ]. $content ; //要發送的短信內容 $phone = $mobile ; //要發送短信的手機號碼 $sendurl = $smsapi . "u=" . $user . "&p=" . $pass . "&m=" . $phone . "&c=" .urlencode( $content ); $result = file_get_contents ( $sendurl ) ; $statusStr = array ( "0" => "短信發送成功" , "-1" => "參數不全" , "-2" => "服務器空間不支持,請確認支持curl或者fsocket,聯系您的空間商解決或者更換空間!" , "30" => "密碼錯誤" , "40" => "賬號不存在" , "41" => "余額不足" , "42" => "帳戶已過期" , "43" => "IP地址限制" , "50" => "內容含有敏感詞" ); if ( is_numeric ( $result ) && $result > 0) { $this ->error = $result . $statusStr [ $result ]; return false; } return true; } |
經過上面的替換,短信寶的短信平臺已經替換成功了,可以正常使用了。進行測試發送:
報備一下短信寶的VIP模板,這樣就可以走短信寶的優質通道了,即便遇到敏感文字我們都不會人工審核,短信內容3~5秒就可送達。
另外:我們已經開發好完整的小鳥云-ZKEYS系統短信寶插件,點擊此鏈接 下載及查看安裝流程。
最新更新
電商類
CMS類
微信類