1.表单传输页面
手机验证码 $action=$_GET["action"]; if ($action=='add') { if ((strtotime($_SESSION['time']) + 60) < time()) {//将获取的缓存时间转换成时间戳加上60秒后与当前时间比较,小于当前时间即为过期 session_destroy(); unset($_SESSION); //header('content-type:text/html; charset=utf-8;'); echo ''; } else { $Code = trim($_POST["TextBox2"]); if (strlen($Code) > 1 and $Code == $_SESSION['rand']) print(""); else print(""); unset($_SESSION['rand']); } } ?>
2.数据处理页面,(发送短信验证)
appkey = $appkey;
$c->secretKey = $secret;
$req = new AlibabaAliqinFcSmsNumSendRequest;
$req->setExtend("");
$req->setSmsType("normal");
$req->setSmsFreeSignName("XX");//你的短信验证签名
$req->setSmsParam("{number:'$rand'}");
$req->setRecNum($phone);
$req->setSmsTemplateCode("XX");//你的短信模板ID
$resp = $c->execute($req);
?>