yershop商城系統是一款基于PHP+MYSQL開源的、免費的電商系統軟件,使用范圍廣泛,今天小編為大家講解一下短信接口開發,我們使用的短信接口是我們短信寶短信群發平臺的接口,我們短信寶短信平臺非常穩定,發送速度快,注冊就送測試短信,推薦大家使用。
首先打開項目:\application\admin\view\systems\index.html 修改15行左右代碼
1
2
3
4
5
6
7
8
|
{ if condition= "$key eq 9" } <div class = "tab_option {eq name='type' value='10'}on{/eq}" > <a href= "{:U('?group=10')}" >{ $vo }配置</a> { else /} <div class = "tab_option {eq name='type' value='$key'}on{/eq}" > <a href= "{:U('?group='.$key)}" >{ $vo }配置</a> {/ if } </div> |
打開項目:\application\index\controller\User.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
|
public function sendSms( $length = 6 , $numeric = 0, $verify = "" ) { if (!check_verify( $verify )){ //$this->error("驗證碼輸入錯誤!"); } $mobile = $_POST [ 'mobile' ]; $map [ "mobile" ]=safe_replace( $mobile ); $info =db( "UcenterMember" )->where( $map )->find(); if (! $info ){ //防用戶惡意請求 $this ->error( '系統未檢測到該手機號' ); } $send_code = $_POST [ 'send_code' ]; $mobile_code = $this -> random(4,1); if ( empty ( $mobile )){ $this ->error( '手機號碼不能為空' ); } if (!session( 'send_code' )|| $send_code !=session( 'send_code' )){ //防用戶惡意請求 $this ->error( '請求超時,請刷新頁面后重試' ); } $u =C( 'SMSBAOUSER' ); $p =md5(C( 'SMSBAOPWD' )); $s = C( 'SMSBAOSING' ); $content = "您的驗證碼是:" . $mobile_code . "。請不要把驗證碼泄露給其他人。" ; $content = '【' . $s . '】' . $content ; //要發送的短信內容 $phone = $mobile ; //要發送短信的手機號碼 $sendurl = $smsapi . "sms?u=" . $u . "&p=" . $p . "&m=" . $phone . "&c=" .urlencode( $content ); $result = file_get_contents ( $sendurl ); if ( $result == 0){ $_SESSION [ 'mobile' ] = $mobile ; $_SESSION [ 'mobile_code' ] = $mobile_code ; $this ->success( '發送短信成功' ); } else { $this ->error( '發送失敗' ); } |
經過上面的替換,短信寶的短信平臺已經替換成功了,可以正常使用了。
報備一下短信寶的VIP模板,這樣就可以走短信寶的優質通道了,即便遇到敏感文字我們都不會人工審核,短信內容3~5秒就可送達。
另外:我們已經開發好完整的yershop問答系統短信寶插件,點擊此鏈接 下載及查看安裝流程。
最新更新
電商類
CMS類
微信類