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(); } |
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!