彩虹易支付系统,专注于聚合支付网站解决方案提供。小编对这款系统还比较了解,今天就以替换短信接口为例为大家讲解一下如何进行二次开发,使用的短信接口是我们短信宝短信群发平头的短信接口,我们短信宝短信群发平台非常稳定,发送速度快,注册就送测试短信,推荐大家使用。
1:打开项目:\includes\lib\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
|
<?php namespace lib\sms; class SmsBao { private $AccessKeyId; private $AccessKeySecret; function __construct($AccessKeyId, $AccessKeySecret){ $ this ->AccessKeyId = $AccessKeyId; $ this ->AccessKeySecret = $AccessKeySecret; } public function send($phone, $code, $moban, $sign, $sitename){ if (empty($ this ->AccessKeyId)||empty($ this ->AccessKeySecret)) return false ; $statusStr = array( "0" => "短信发送成功" , "-1" => "参数不全" , "-2" => "服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!" , "30" => "密码错误" , "40" => "账号不存在" , "41" => "余额不足" , "42" => "帐户已过期" , "43" => "IP地址限制" , "50" => "内容含有敏感词" ); $content = '【' .$sign. '】' .str_replace( '{$code}' ,$code,$moban); $user = $ this ->AccessKeyId; //短信平台帐号 $pass = md5($ this ->AccessKeySecret); //短信平台密码 $sendurl = $smsapi. "sms?u=" .$user. "&p=" .$pass. "&m=" .$phone. "&c=" .urlencode($content); $result =file_get_contents($sendurl) ; if ($result == 0){ return [ 'Code' => 'OK' , 'Message' => 'success' ]; } return [ 'Message' =>$statusStr[$result]]; } } |
2:打开项目:includes\functions.php 修改send_sms 方法
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
|
<?php namespace lib\sms; class SmsBao { private $AccessKeyId; private $AccessKeySecret; function __construct($AccessKeyId, $AccessKeySecret){ $ this ->AccessKeyId = $AccessKeyId; $ this ->AccessKeySecret = $AccessKeySecret; } public function send($phone, $code, $moban, $sign, $sitename){ if (empty($ this ->AccessKeyId)||empty($ this ->AccessKeySecret)) return false ; $statusStr = array( "0" => "短信发送成功" , "-1" => "参数不全" , "-2" => "服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!" , "30" => "密码错误" , "40" => "账号不存在" , "41" => "余额不足" , "42" => "帐户已过期" , "43" => "IP地址限制" , "50" => "内容含有敏感词" ); $content = '【' .$sign. '】' .str_replace( '{$code}' ,$code,$moban); $user = $ this ->AccessKeyId; //短信平台帐号 $pass = md5($ this ->AccessKeySecret); //短信平台密码 $sendurl = $smsapi. "sms?u=" .$user. "&p=" .$pass. "&m=" .$phone. "&c=" .urlencode($content); $result =file_get_contents($sendurl) ; if ($result == 0){ return [ 'Code' => 'OK' , 'Message' => 'success' ]; } return [ 'Message' =>$statusStr[$result]]; } } |
好了经过以上的添加,短信宝彩虹易支付系统增加手机验证就已经安装成功,可以正常使用了
报备一下短信宝的VIP模板,这样就可以走短信宝的优质通道了,即便遇到敏感文字我们都不会人工审核,短信内容3~5秒就可送达。
另外:我们已经开发好完整的彩虹易支付系统系统短信宝插件,点击此链接 下载及查看安装流程。
最新更新
电商类
CMS类
微信类