thinkphp 手机号,qq号,邮箱 验证 邮编

来源:互联网 发布:淘宝店铺直播怎么开通 编辑:程序博客网 时间:2024/04/20 06:39
 if(I('mobile')!=null&&I('post.qq')!=null&&I('post.email')!=null){
         if(preg_match("/^1[34578]{1}\d{9}$/",I('mobile'))){  
          if(preg_match("/^[1-9]\d{4,10}$/",I('post.qq'))){
            if( preg_match("/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/",I('post.email'))){
            $data['mobile']=I('mobile');
            $data['qq']=I('post.qq');    
            $data['email']=I('post.email');
            $condition['id']=session('user_id');
            $res=$User->where($condition)->save($data);
            if($res==true){
              $this->success('修改基本资料成功');            
            } 
            if($res==false){
              $this->error('你未对资料做修改');  
            }
            }else{
              $this->error('不是邮箱');
            }
           
}else{
 $this->error('不是QQ号');
}
       
}else{  
    $this->error('不是手机号码');  

           }else{
             $this->error('数据不能为空');

           }




preg_match("/^[a-zA-Z0-9_\-]{1,}@[a-zA-Z0-9_\-]{1,}\.[a-zA-Z0-9_\-.]{1,}$/",$_POST['da']['zone']) //验证邮编

0 0
原创粉丝点击