ThinkLCV4.0新增短信宝短信接口
发表日期:2021-03-08 文章编辑:短信宝小编 浏览次数:
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
|
<?phpheader( "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系统短信宝插件,点击此链接 下载及查看安装流程。

