Home > Backend Development > PHP Tutorial > PHP verifies whether the username starts with a letter and verifies the password_PHP tutorial

PHP verifies whether the username starts with a letter and verifies the password_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-15 13:22:13
Original
916 people have browsed it

Verify whether the username starts with a letter and verify that the password can only be a combination of numbers and letters
Three commonly used verification functions Verify email address format Verify password can only be a combination of numbers and letters Verify whether the username starts with a letter code, this is used when users register or submit forms.

function is_email($email)
 {
  if (preg_match("/[a-za-z0-9]+@[a-za-z0-9]+.[a-z]{2,4}/",$email,$mail))
  {
      return true;
  }
  else
  {
      return false;
  }
 } /**
  * 验证用户名是否以字母开头
  */


function is_user_name($user)
 {
  if (preg_match("/^[a-za-z]{1}([a-za-z0-9]|[._]){3,19}$/",$user,$username))
  {
      return true;
  }
  else
  {
      return false;
  }
 } /**
  * 验证密码只能为数字和字母的组合
  */


function is_ps教程d($psd)
 {
  if (preg_match("/^(w){4,20}$/",$psd,$password))
  {
      return true;
  }
  else
  {
      return false;
  }
 }
Copy after login

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/447003.htmlTechArticleVerify whether the username starts with a letter and verify that the password can only be a combination of numbers and letters. Three commonly used codes The verification function verifies the email address format and the verification password can only be numbers and letters...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template