Home  >  Article  >  Backend Development  >  How to write php login

How to write php login

藏色散人
藏色散人Original
2019-10-14 10:06:563450browse

How to write php login

How to write php login?

1. First create a login form. (This is all HTML, no explanation).

<form action="" method="post">
<input type="text" name="username" /><br>
<input type="password" name="pwd" /><br />
<input type="submit" name="login" value="登录" />
</form>

2. Start writing the PHP processing program, and start writing on top of the code you just wrote:

$username = "admin"; //要登录的账号
$pwd = "123456"; //要使用的密码
if ($username==$_POST[username]&&$pwd==$_POST[pwd]){
echo "登陆成功!";
}else{
echo "账号或密码错误";
exit();
}

In fact, this is a very simple user system.

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of How to write php login. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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