include('aldy/TopClient.php'); //这个是你下面实例化的类 include('aldy/ResultSet.php'); //这个是topClient 里面需要实例化一个类所以我们也要加载 不然会报错 include('aldy/RequestCheckUtil.php'); //这个是成功后返回的信息文件 include('aldy/TopLogger.php'); //这个是错误信息返回的一个php文件 include('aldy/AlibabaAliqinFcSmsNumSendRequest.php'); //这个也是你下面示例的类 //短信发送 模版id(TemplateCode),发送号码(RecNum),FreeSignName(短信签名) function send_sms($TemplateCode,$RecNum,$FreeSignName){ $c = new TopClient; $c->appkey = ;//appkey值 $c->secretKey = ;//secretKey值 $req = new AlibabaAliqinFcSmsNumSendRequest; //$req->setExtend("123456"); $req->setSmsType("normal"); $req->setSmsFreeSignName($FreeSignName); $req->setSmsParam("{\"code\":\"1234\",\"product\":\"alidayu\"}");.//模版参数 $req->setRecNum($RecNum); $req->setSmsTemplateCode($TemplateCode); $resp = $c->execute($req); $content = json_decode(json_encode($resp),true); try { $result= $content['sub_msg']; throw new Exception('It is an exception!'); } catch (Exception $e) { if( $content['result']['success'] == 'true' ){ $result= '发送成功'; }else{ $result= '发送失败'; } } echo $result; exit(); } |
版权声明: 本站资源均来自互联网或会员发布,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!
转载请注明: 织梦dedecms支持短信验证发送解决方案