yershop商城系统是一款基于PHP+MYSQL开源的、免费的电商系统软件,使用范围广泛,今天小编为大家讲解一下短信接口开发,我们使用的短信接口是我们短信宝短信群发平台的接口,我们短信宝短信平台非常稳定,发送速度快,注册就送测试短信,推荐大家使用。
首先打开项目:\application\admin\view\systems\index.html 修改15行左右代码
| 
						1 
						2 
						3 
						4 
						5 
						6 
						7 
						8 |   {ifcondition="$key eq 9"}              <div class="tab_option {eq name='type' value='10'}on{/eq}">              <a href="{:U('?group=10')}">{$vo}配置</a>          {else/}            <div class="tab_option {eq name='type' value='$key'}on{/eq}">              <a href="{:U('?group='.$key)}">{$vo}配置</a>          {/if}      </div> | 
打开项目:\application\index\controller\User.php 添加短信宝插件代码
| 
						1 
						2 
						3 
						4 
						5 
						6 
						7 
						8 
						9 
						10 
						11 
						12 
						13 
						14 
						15 
						16 
						17 
						18 
						19 
						20 
						21 
						22 
						23 
						24 
						25 
						26 
						27 
						28 
						29 
						30 
						31 
						32 
						33 
						34 
						35 
						36 | publicfunctionsendSms($length= 6 , $numeric= 0,$verify="") {    if(!check_verify($verify)){        //$this->error("验证码输入错误!");    }    $mobile= $_POST['mobile'];    $map["mobile"]=safe_replace($mobile);    $info=db("UcenterMember")->where($map)->find();    if(!$info){        //防用户恶意请求        $this->error('系统未检测到该手机号');    }    $send_code= $_POST['send_code'];    $mobile_code=$this-> random(4,1);    if(empty($mobile)){        $this->error('手机号码不能为空');    }    if(!session('send_code')||$send_code!=session('send_code')){        //防用户恶意请求        $this->error('请求超时,请刷新页面后重试');    }    $u=C('SMSBAOUSER');    $p=md5(C('SMSBAOPWD'));    $s= C('SMSBAOSING');    $content= "您的验证码是:".$mobile_code."。请不要把验证码泄露给其他人。";    $content='【'.$s.'】'.$content;//要发送的短信内容    $phone= $mobile;//要发送短信的手机号码    $sendurl= $smsapi."sms?u=".$u."&p=".$p."&m=".$phone."&c=".urlencode($content);    $result=file_get_contents($sendurl);    if($result== 0){        $_SESSION['mobile'] = $mobile;        $_SESSION['mobile_code'] = $mobile_code;        $this->success('发送短信成功');    }else{        $this->error('发送失败');    } | 
经过上面的替换,短信宝的短信平台已经替换成功了,可以正常使用了。
	
报备一下短信宝的VIP模板,这样就可以走短信宝的优质通道了,即便遇到敏感文字我们都不会人工审核,短信内容3~5秒就可送达。
另外:我们已经开发好完整的yershop问答系统短信宝插件,点击此链接 下载及查看安装流程。
最新更新
电商类
CMS类
微信类