当前位置: 首页>>代码示例>>PHP>>正文


PHP XString::isPhone方法代码示例

本文整理汇总了PHP中XString::isPhone方法的典型用法代码示例。如果您正苦于以下问题:PHP XString::isPhone方法的具体用法?PHP XString::isPhone怎么用?PHP XString::isPhone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XString的用法示例。


在下文中一共展示了XString::isPhone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doRegister

    private function doRegister($request, $response)
    {/*{{{*/
        $result = array('err' => array(), 'user' => new NullEntity());
        $name = mb_strtolower($request->username, 'GB2312');
        $pass1 = $request->password;
        $pass2 = $request->password2;
        $phone = $request->phone;
        $mobile = $request->mobile;
        $email = $request->email;
        $city = $request->city;
        $question = $request->pwdQ;
        $answer = $request->pwdA;
        $isDoctor = $request->is_doctor;
        $patientCardNO = $request->patientCardNO;

        $verifyOk = Captcha::verify($request->verifyStr, XIpLocation::getIp(), 'login', $request->captchaId, $request->token);

        //username
        $utf8name = mb_convert_encoding($name, 'utf8', 'gbk');
        $result['err'] = $this->checkUsername(self::ERROR_RESULT_ARRAY, $name, $utf8name);

        //verifycode
        if($verifyOk == false)
        {
            $result['err'][] = "验证码错误";
        }

        //password
        if (!preg_match("/^[0-9a-zA-Z]{4,16}$/", $pass1)) $result['err'][] = "密码格式错误, 只能为4-16位数字或字母";
        if ($pass1 != $pass2) $result['err'][] = "密码校验错误";

        //others 
        if ($phone && false == XString::isPhone($phone)) { $result['err'][] = "电话格式错误"; }
        if ($mobile && false == XString::isMobile($mobile)) { $result['err'][] = "您填写的手机号码不合要求,请修改后重新提交";}
        if ($email && false == XString::isEmail($email)) { $result['err'][] = "邮件格式错误"; }

        //patient card
        if(empty($patientCardNO) == false && $this->checkPatientCardNO($patientCardNO) == false)
        {
            $result['err'][] = "您输入的随访码不正确,请核对医生发放的随访码";
        }

        if (false == empty($result['err']))
        {
            return $result;
        }

        $data = array(
            'realName' => '',
            'sex' => 1,
            'phone' => $phone,
            'mobile' => $mobile,
            'email' => $email,
            'birthday' => '0',
            'idcard' => '',
            'province' => '',
            'city' => $city,
            'district' => '',
            'question' => $question,
            'answer' => $answer,
            'ip' => UserClient::getInstance()->getIp(),
        );

        if (!$data['email'])  unset($data['email']);
        if (!$data['mobile']) unset($data['mobile']);

        $user = UserClient::getInstance()->register($name, $pass1, $data);
		if ($user->isNull())
        {
            $result['err'][] = "请稍后重新注册";
        }
        else
        {
            $result['user'] = $user;
        }

        return $result;
    }/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:78,代码来源:usercontroller.php

示例2: step1update

	/**
	 * 不用Seeion这个方法目前有安全隐患 
	 */
    public function step1update($request, $response)
    {
    	$doctorId = Codec::getInstance()->decodeId($request->doctor_id);
    	$userName = $request->username;
    	$email = $request->email;
		$phone = $request->phone;
		$phone_note = $request->phone_note;
		$phonePrefix = $request->phonePrefix;
        $phone = (empty($phonePrefix)) ? $phone : $phonePrefix."-".$phone;

		$mobile = $request->mobile;
		$realName = $request->realname;
		$password = $request->password;
		$urlAry = array( 
			'u' => $userName,
			'r' => $realName,
			'e' => $email,
			'p' => $phone,
			'm' => $mobile,
			'x' => $password,
			'y' => $phone_note,
            'doctor_id' => Codec::getInstance()->encodeId($doctorId)
        );
        if (!empty($email) && XString::isEmail($email) == false)
			$err = "邮件格式错误";
		if (!empty($phone) && false == XString::isPhone($phone)) $err = "电话格式错误";
        if (!empty($mobile) && false == XString::isMobile($mobile))
            $err = "您填写的手机号码不合要求,请修改后重新提交";
        $valueUserMobile = UserClient::getInstance()->getSpaceByUserMobile($mobile);
        if(empty($err) && !empty($mobile) && $valueUserMobile)
            $err = "此手机号码已经绑定了注册医生,请重新确定手机号";
		
		$user = UserClient::getInstance()->getCurrentUser();
		if(empty($err))
		{
			if (empty($phone_note) == false)
				$phone .= "($phone_note)";
			$data = array(
				'email' => $email,
				'phone' => $phone,
				'mobile' => $mobile,
				'realName' => $realName,
			);
			$userId = UserClient::getInstance()->modifyInfoNew($user->id, $data);
			if ($userId > 0)
			{
				if (empty($doctorId))
					header('Location: '.$response->router->urlfor('doctorreg/step2locate', array()));
				else
					header('Location: '.$response->router->urlfor('doctorreg/step2bind', array('doctor_id'=>$doctorId)));
			}
			else
			{
				header('Location: '.$response->router->urlfor('doctorreg/step1account', array(
					'doctor_id'=>Codec::getInstance()->$doctorId, 
					'msg'=>urlencode('修改失败,请稍后再试')
				)));
			}
		}
		else
		{
            $urlAry['msg'] = $err;
			header('Location: '.$response->router->urlfor('doctorreg/step1account', $urlAry));
		}
		exit();
    }
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:69,代码来源:doctorregcontroller.php


注:本文中的XString::isPhone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。