php发送短信接口
2018-01-04 15:14
316 查看
public function sendSelfVerifyCode() { $phonenumber =$_POST('phonenumber'); $type = ''; $code = rand(100000, 999999); $result = $this->SendSMS($code, $phonenumber,$type); //type 短信模板 //$code =123456; //$result=1; if($result==1){ $_SESSION['code']=$code; //验证码写入session $_SESSION['time']= time()+60*3; //设定验证码 过期时间 $return_data['status'] = $result; return $return_data; }else{ $return_data['msg'] = $result; return $return_data; } } } function SendSMS($code ="", $mobile ="", $type="") { include ('SmsDemo.php'); // 引入短信类,短信服务商提供api $ucpass = new \SmsDemo(); switch ($type){ case '1': $Template ="SMS_1";break; case '2': $Template="SMS_2";break; case '3': $Template="SMS_3";break; case '4': $Template="SMS_4";break; } $response= $ucpass->sendSms($code , $mobile, $Template); //发送短信 //初始化 $options必填 $data = json_decode(json_encode($response),true); //先json 加密 在解密 转为PHP数组 if($data['Code']=="OK"){ return 1; }else{ return $data['code']; } }
相关文章推荐
- PHP下基于创蓝253接口的短信发送
- 手机验证码平台,怎么发送手机验证码,php开发手机验证码短信接口功能
- php调用云片网接口发送短信的实现方法
- php天翼开放平台短信发送接口实现方法
- 阿里大鱼短信接口PHP版,精简版阿里大鱼短信SMS发送接口PHP实例
- php发送短信(调用阿里大鱼接口)
- php手机短信接口发送验证码
- 企信通PHP HTTP接口 发送短信
- php调用短信接口,php发送短信接口
- php调用云片网接口发送短信实例
- php天翼开放平台短信发送接口实现方法
- php编程之短信发送接口调用流程的实现
- 飞信PHP接口|飞信PHP API免费发送手机短信接口,thinkphp发送单条函数
- PHP通过串口实现发送短信
- android 中调用接口发送短信
- SmsSendUtils 短信发送接口调用
- PHP如何向.NET接口webservice发送xml请求
- php 阿里云短信服务及阿里大于实现短信验证码的发送