点击 【获取验证码】 执行ajax
PHP:ajax执行的PHP -> balidate.php
$phone = $_GPC['uphone'];//发送的电话号码
if(!preg_match("/^1[3|4|5|6|7|8|9][0-9]\d{4,8}$/",$phone)){
$error = array('t' => false,'msg' => "请正确填写手机号码");
echo json_encode($error);exit;
}else{
include "SmsDemo.php";**引入发送短信的文件**可修改路径
$alidayv_accesskeyid = 你的阿里大于alidayv_accesskeyid;// $alidayv_accesskeyid
$alidayv_accesskeysecret = 你的阿里大于alidayv_accesskeysecret;// $alidayv_accesskeysecret
$sms_mb = 你的阿里大于alidayv_muban;//发送短信的模板 $alidayv_muban
$sms_qm = 你的阿里大于alidayv_qianming;//发送短信的签名 $alidayv_qianming
$chars='0123456789';//此处为随机获取的验证码
for($i=0;$i<6;$i++){
$rand.=substr($chars,(mt_rand()%strlen($chars)),1);//验证码
}
//主代码
$response = SmsDemo::sendSms($phone,$sms_mb,$sms_qm,$alidayv_accesskeyid,$alidayv_accesskeysecret,$rand);
if($re