ThinkLC是一款基于PHP+MYSQL開發的地方分類信息系統,完全面向對象的技術架構設計開發。便于二次開發,小編對于這款軟件還是比較了解的,下面小編就帶著大家一起進行短信接口的新增開發。使用的短信接口是我們短信寶短信群發平臺的接口,我們短信寶短信群發平臺非常穩定,發送速度快,注冊還送測試短信,推薦大家使用
1:ThinkLC短信插件存放于SaxueFrame\sms文件夾中,我們在其中新建smsbao.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
|
<?php header( "Content-type:text/html; charset=UTF-8" ); //編碼格式 /** * 短信寶短信接口 */ class saxuesms extends saxueobject { protected $statusStr = array( "0" => "短信發送成功" , "-1" => "參數不全" , "-2" => "服務器空間不支持,請確認支持curl或者fsocket,聯系您的空間商解決或者更換空間!" , "30" => "密碼錯誤" , "40" => "賬號不存在" , "41" => "余額不足" , "42" => "帳戶已過期" , "43" => "IP地址限制" , "50" => "內容含有敏感詞" ); protected $uid = '' ; //短信寶帳號 protected $pass = '' ; //短信寶密碼 protected $sign = '' ; //短信簽名 protected $mobile = '' ; protected $content = '' ; public function __construct( $mobile, $content, $iscode = true ) { $ this ->mobile = $mobile; if (empty($mobile)) { $ this ->raiseerror( '手機號碼不能為空' ,SAXUE_ERROR_RETURN); } if ( $iscode ) { $ this ->content = '【' .$ this ->sign. '】您的驗證碼:' . $content . '(10分鐘內有效)' ; } else { $ this ->content = $content; } } public function sendsms() { $url = 'http://api.smsbao.com/sms?u=' .$ this ->uid. '&p=' .md5($ this ->pass). '&m=' .$ this ->mobile. '&c=' .$ this ->content; $request = $ this ->SmsPost($url); if ($request != 0) { $ this ->raiseerror( '錯誤代碼:' .$statusStr[$request],SAXUE_ERROR_RETURN); } } protected function SmsPost($url){ if (function_exists( 'file_get_contents' )){ $file_contents = file_get_contents($url); } else { $ch = curl_init(); $timeout = 5; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $file_contents = curl_exec($ch); curl_close($ch); } return $file_contents; } } ?> |
好了經過以上的添加,短信寶ThinkLC_4.0系統增加手機驗證就已經安裝成功,可以正常使用了
報備一下短信寶的VIP模板,這樣就可以走短信寶的優質通道了,即便遇到敏感文字我們都不會人工審核,短信內容3~5秒就可送達。
另外:我們已經開發好完整的ThinkLC_4.0系統短信寶插件,點擊此鏈接 下載及查看安裝流程。
最新更新
電商類
CMS類
微信類