當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XString::isEmail方法代碼示例

本文整理匯總了PHP中XString::isEmail方法的典型用法代碼示例。如果您正苦於以下問題:PHP XString::isEmail方法的具體用法?PHP XString::isEmail怎麽用?PHP XString::isEmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XString的用法示例。


在下文中一共展示了XString::isEmail方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testIsEmail

    public function testIsEmail()
    {/*{{{*/
        $this->assertTrue(XString::isEmail('ysq@haodf.com'));
        $this->assertTrue(XString::isEmail('y1@haodf.com'));
        $this->assertTrue(XString::isEmail('123456@haodf.com'));
        $this->assertTrue(XString::isEmail('y.s.q@haodf.com'));
        $this->assertTrue(XString::isEmail('y_s_q@haodf.com'));

        $this->assertFalse(XString::isEmail(123));
        $this->assertFalse(XString::isEmail('abc'));
        $this->assertFalse(XString::isEmail('123@haodf'));
        $this->assertFalse(XString::isEmail('13839799202@.com'));
    }/*}}}*/
開發者ID:sdgdsffdsfff,項目名稱:hdf-client,代碼行數:13,代碼來源:xstring.php

示例2: validateSaveTasktemplate4Common

 private function validateSaveTasktemplate4Common($request, array &$validateInfo)
 {
     /*{{{*/
     if (false == TaskTemplate::scriptPathIsRight(trim($request->scriptpath))) {
         $validateInfo['error'][] = '路徑輸入不正確';
     }
     if (trim($request->title) == '') {
         $validateInfo['error'][] = 'title不可為空';
     }
     if (false == file_exists(trim($request->scriptpath))) {
         $validateInfo['warning'][] = '你輸入的腳本路徑在現有代碼中不存在';
     }
     if (trim($request->scriptauthoremail) == '') {
         $validateInfo['error'][] = '腳本作者email不能為空';
     } else {
         if (false == XString::isEmail(trim($request->scriptauthoremail))) {
             $validateInfo['error'][] = '腳本作者email格式不正確';
         }
     }
     if (trim($request->scriptauthorleaderemail) == '') {
         $validateInfo['error'][] = '團隊Leader email不能為空';
     } else {
         if (false == XString::isEmail(trim($request->scriptauthorleaderemail))) {
             $validateInfo['error'][] = '團隊leader email格式不正確';
         }
     }
     if (trim($request->scriptauthormobile) == '') {
         $validateInfo['error'][] = '作者電話不可為空';
     } else {
         if (false == XString::isMobile($request->scriptauthormobile)) {
             $validateInfo['error'][] = '您輸入的11位作者手機號碼格式不正確';
         }
     }
     if (trim($request->scriptauthorleadermobile) == '') {
         $validateInfo['error'][] = '團隊leader電話不可為空';
     } else {
         if (false == XString::isMobile($request->scriptauthorleadermobile)) {
             $validateInfo['error'][] = '您輸入的11位團隊leader手機號碼格式不正確';
         }
     }
     if (false == CronConfigMgr::cronConfigIsRight(CronConfigMgr::getCronConfigUseSSH())) {
         $validateInfo['error'][] = '機器上的cron配置格式有問題';
     }
 }
開發者ID:sdgdsffdsfff,項目名稱:hdf-client,代碼行數:44,代碼來源:taskmgrcontroller.php

示例3: 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

示例4: 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::isEmail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。