- A+
所属分类:站长之家
phpyun人才系统功能强大后台操作简单,功能丰富。可惜没有提供阿里云短信的API接口,笔者闲余时间研究下方法其实也好实现。
1.首先去下载阿里云短信的SKD
2.然后将api_sdk文件夹放在/app/include/目录下
3.修改phpyun的短信模块/app/model/ notice.mode.php
4.找到public function sendSMS($data) 并修改

5.添加一个自定发送函数alisendSms
public function alisendSms($data){
$type=$data["type"];
include_once(LIB_PATH.'aliyunsms.class.php');
$a= new aliyunsms();
$res="";
$re= "";
switch ($type) {
case 'getpass':
$phone=$data["moblie"];
$tempCode="SMS_199201760";
$smsParam=array("code"=>$data["code"]);
$re= $a->sendSms($phone,$tempCode,$smsParam);
break;
case 'regcode':
$phone=$data["moblie"];
$tempCode="SMS_199201765";
$smsParam=array("code"=>$data["code"]);
$re= $a->sendSms($phone,$tempCode,$smsParam);
break;
case 'cert':
$phone=$data["moblie"];
$tempCode="SMS_200178590";
$smsParam=array("code"=>$data["code"]);
$re= $a->sendSms($phone,$tempCode,$smsParam);
break;
case 'userstatus':
$phone=$data["moblie"];
$tempCode="SMS_199201757";
$smsParam=array("auto_statis"=>"已经通过审。","date"=>date('Y-m-d h:i:s', time()),"webtel"=>"130-3258-6955");
$re= $a->sendSms($phone,$tempCode,$smsParam);
break;
default:
# code...
break;
}
if ($re->Message=='OK') {
$res="1";
}
return $res;
}
6.即可实现阿里云短信发送。