1.手机验证码登录
public function login(Request $request){
$tel=$request->get('phoneNum');
if (Cache::has($tel)){
$num=Cache::get($tel);
}else{
$num=Cache::put($tel,0);
}
if ($num>30){
return $this->getJsonData(10010,'一天只能请求30次',null);
}
$smsapi = $this->smsapi;
$user = $this->user;
$pass = md5($this->pass);
$rand=rand(1000,9999);
$content="【八维】:您的验证码:".$rand;
$phone = $tel;
$sendurl = $smsapi."sms?u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content);
$result =file_get_contents($sendurl) ;
if ($result!=0){
Cache::increment($tel,1);
Cache::put('code',$rand);
return $this->getJsonData(200,'获取成功',$rand);
}