1 $type = "SMS_53840088"; 2 $signName = '注册验证'; 3 $param = json_encode(array('code'=>$data['rand_num'],'product'=>$data['projectName'])); 4 $return = $messages->stort_message($type,$data['tel'],$signName,$param);
1 <?php 2 class message 3 { 4 public function stort_message($type,$tel,$signName,$param) 5 { 6 require PIGCMS_CORE_PATH."libs/org/Alidayu/TopSdk.php"; 7 date_default_timezone_set('Asia/Shanghai'); 8 $c = new TopClient; 9 $c->appkey = '23694723'; 10 $c->secretKey = 'a5e4dd4fb0a6235a852887288f13d666'; 11 $req = new AlibabaAliqinFcSmsNumSendRequest; 12 $req->setExtend(""); 13 $req->setSmsType("normal"); 14 $req->setSmsFreeSignName($signName); 15 $req ->setSmsParam($param); 16 $req->setRecNum($tel); 17 $req->setSmsTemplateCode($type); 18 $resp = $c->execute($req); 19 $return=json_decode( json_encode( $resp),true); 20 if($return['result']['success'] == "true" && $return['result']['err_code']==0){ 21 return true; 22 }else{ 23 return false; 24 } 25 26 } 27 28 }