| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- //这个文件用来实现与短信相关的函数
- function SendGSMMessage($phone, $content)
- {
- $name = "SDK-ZQ-XXKJ-0482";
- $pwd = "hhyz122131";
- $msg = rawurlencode($content);
-
- $res = file_get_contents("http://sms.4006555441.com/webservice.asmx/mt?Sn=" . $name . "&Pwd=" . $pwd . "&mobile=" . $phone . "&content=" . $msg);
-
- return $res;
- }
- function GetRandomNum()
- {
- $str = '0123456789';
- $rndcode = rand(0,9);
- $rndNum = $str[$rndcode];
- return $rndNum;
- }
- function SendCaptcha($phone, $shopname)
- {
- //先生成一个随机的6位数验证码
- $Char1 = $this->GetRandomNum();
- $Char2 = $this->GetRandomNum();
- $Char3 = $this->GetRandomNum();
- $Char4 = $this->GetRandomNum();
- $Char5 = $this->GetRandomNum();
- $Char6 = $this->GetRandomNum();
-
- $captcha = $Char1 . $Char2 . $Char3 . $Char4 . $Char5 . $Char6;
- $content = "尊敬的顾客您好,您本次在店铺“" . $shopname . "”微信点单的验证码为" . $captcha . ",请您在订单提交页面输入本验证码进行手机号码验证,验证码有效时间10分钟。";
-
- SendGSMMessage($phone, $content);
- }
- ?>
|