ThinkLC是一款基于PHP+MYSQL開發(fā)的地方分類信息系統(tǒng),完全面向?qū)ο蟮募夹g(shù)架構(gòu)設(shè)計開發(fā)。便于二次開發(fā),小編對于這款軟件還是比較了解的,我們今天講的是ThinkLC_3.8版本。使用的短信接口是我們短信寶短信群發(fā)平臺的接口,我們短信寶短信群發(fā)平臺非常穩(wěn)定,發(fā)送速度快,注冊還送測試短信,推薦大家使用。
我們需要在項目根目錄SaxueFrame\source\sms文件中創(chuàng)建一個名為smsbao.php的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
|
<?phpheader("Content-type:text/html;charset:UTF-8");/*** 短信寶短信接口*/class saxuesms extends saxueobject{ protected $statusStr = array( "0" => "短信發(fā)送成功", "-1" => "參數(shù)不全", "-2" => "服務(wù)器空間不支持,請確認(rèn)支持curl或者fsocket,聯(lián)系您的空間商解決或者更換空間!", "30" => "密碼錯誤", "40" => "賬號不存在", "41" => "余額不足", "42" => "帳戶已過期", "43" => "IP地址限制", "50" => "內(nèi)容含有敏感詞" ); 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分鐘內(nèi)有效)'; }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; $ret = $this->SmsPost($url); if ($ret != 0) { $this->raiseerror('錯誤代碼:'.$this->statusStr[$ret],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; }} |
好了,經(jīng)過以上的創(chuàng)建,短信寶的短信平臺已經(jīng)替換成功了,可以正常使用了。進行發(fā)送測試:

報備一下短信寶的VIP模板,這樣就可以走短信寶的優(yōu)質(zhì)通道了,即便遇到敏感文字我們都不會人工審核,短信內(nèi)容3~5秒就可送達。
另外:我們已經(jīng)開發(fā)好完整的ThinkLC分類信息系統(tǒng)短信寶插件,點擊此鏈接 下載及查看安裝流程。
最新更新
電商類
CMS類
微信類