include('aldy/TopClient.php'); //這個是你下面實例化的類 include('aldy/ResultSet.php'); //這個是topClient 里面需要實例化一個類所以我們也要加載 不然會報錯 include('aldy/RequestCheckUtil.php'); //這個是成功后返回的信息文件 include('aldy/TopLogger.php'); //這個是錯誤信息返回的一個php文件 include('aldy/AlibabaAliqinFcSmsNumSendRequest.php'); //這個也是你下面示例的類 //短信發(fā)送 模版id(TemplateCode),發(fā)送號碼(RecNum),F(xiàn)reeSignName(短信簽名) 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\"}");.//模版參數(shù) $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= '發(fā)送成功'; }else{ $result= '發(fā)送失敗'; } } echo $result; exit(); } |
版權(quán)聲明: 本站資源均來自互聯(lián)網(wǎng)或會員發(fā)布,如果侵犯了您的權(quán)益請與我們聯(lián)系,我們將在24小時內(nèi)刪除!謝謝!
轉(zhuǎn)載請注明: 織夢dedecms支持短信驗證發(fā)送解決方案