我给个大致的思路代码,有能力的朋友可以集成,有需要技术服务的可以联系我(收费),站内集成注册验证,提问回复短信提醒,修改密码,活动报名验证及提醒等!
演示:http://www.cncal.com/account/register/
public function SmsParam($mobile, $type) {
if (empty($mobile) OR !$this->ismobile($mobile) OR empty($type))
{
return false;
}
$code = $this->random(6);
$sign = AWS_APP::lang()->_t('温馨提示');
$sitename = AWS_APP::lang()->_t('仪器信息网');
switch($type) {
case 'register':
$tpl = '';
break;
case 'activity':
$tpl = '';
break;
case 'login':
$tpl = '';
break;
case 'password':
$tpl = '';
break;
case 'infoedit':
$tpl = '';
break;
case 'identity':
$tpl = '';
break;
}
$SmsParam = '{"code":"{code}","product":"{product}"}';
$SmsParam = str_replace(array('{code}', '{product}'), array($code, $sitename), $SmsParam);
include(AWS_PATH . 'Services/Alisms/TopSdk.php');
date_default_timezone_set('Asia/Shanghai');
$c = new TopClient;
$c->appkey = ''; //阿里APP证书AppKey
$c->secretKey = ''; //阿里APP证书AppSecret
$r = new AlibabaAliqinFcSmsNumSendRequest;
$r->setSmsType('normal');
$r->setSmsFreeSignName($sign);
$r->setSmsParam($SmsParam);
$r->setRecNum($mobile);
$r->setSmsTemplateCode($tpl);
$e = $c->execute($r);
if($e->result->success) {
return json_encode(array('mobile' => $mobile, 'add_time' => time()));
} else {
return false;
}
}
阅读全文
收起全文