php短信接口(阿里大鱼)

接口文件在阿里大鱼官方手册内有   

  public function alidayu($mobile){

        include VENDOR_DIR ."/alidayu/TopSdk.php";//引入入口文件
        date_default_timezone_set('Asia/Shanghai'); 
        $content = rand(100000,999999);
        $signname = "登录验证";
        $c = new \TopClient;
        $c->appkey = "23491577";//必填用户appkey 
        $c->secretKey = "60c9cab4f6913daa49c53f5fd0dc5d15";//必填 用户secretKey 
        $req = new \AlibabaAliqinFcSmsNumSendRequest;
        $req->setSmsType("normal");//短信接口填写normal
        $req->setSmsFreeSignName($signname);
        $req->setSmsParam("{\"code\":\"".$content."\",\"product\":\"诺蜜\"}");//验证码和网站名字
        $req->setRecNum($mobile);
        $req->setSmsTemplateCode("SMS_13745711");//短息模板 由阿里大鱼用户提供认证通过才行
        $resp = $c->execute($req);
        if($resp->result->success){
           return $content;
        }else{
           return 'error';
        }
   }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值