用php写一个简单的网站登录界面
时间: 2023-05-16 10:05:16 浏览: 93
好的,以下是一个简单的网站登录界面的 PHP 代码:
```
<!DOCTYPE html>
<html>
<head>
<title>登录</title>
</head>
<body>
<h2>登录</h2>
<form action="login.php" method="post">
<label for="username">用户名:</label>
<input type="text" id="username" name="username"><br><br>
<label for="password">密码:</label>
<input type="password" id="password" name="password"><br><br>
<input type="submit" value="登录">
</form>
</body>
</html>
```
请注意,这只是一个简单的登录界面,需要与后端代码配合使用才能实现完整的登录功能。
相关问题
用html写一个简单的登陆界面
以下是一个简单的登陆界面的HTML代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
background-color: #f1f1f1;
}
form {
border: 3px solid #f1f1f1;
max-width: 500px;
margin: 50px auto;
background-color: white;
padding: 20px;
}
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
.cancelbtn {
background-color: #f44336;
}
.container {
padding: 16px;
}
span.psw {
float: right;
padding-top: 16px;
}
@media screen and (max-width: 500px) {
form {
border: none;
}
}
</style>
</head>
<body>
<form action="/action_page.php">
<div class="container">
<h1>Login</h1>
<hr>
<label for="username"><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="username" required>
<label for="password"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="password" required>
<button type="submit">Login</button>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
</div>
<div class="container" style="background-color:#f1f1f1">
<button type="button" class="cancelbtn">Cancel</button>
<span class="psw">Forgot <a href="#">password?</a></span>
</div>
</form>
</body>
</html>
```
这段代码会生成一个简单的登陆界面,包括用户名和密码输入框,登录按钮以及忘记密码和取消按钮。你可以根据需要进行样式和布局的调整。
用php写一个美观的登陆界面
好的,以下是一个简单的美观的登陆界面的 PHP 代码:
```php
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>登录</title>
<style>
body {
background-color: #f1f1f1;
font-family: Arial, sans-serif;
}
form {
background-color: #fff;
border: 1px solid #ccc;
padding: 20px;
max-width: 400px;
margin: 50px auto;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
label, input[type="text"], input[type="password"], button {
display: block;
width: 100%;
margin-bottom: 10px;
font-size: 16px;
}
label {
font-weight: bold;
margin-bottom: 5px;
}
input[type="text"], input[type="password"] {
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
button {
background-color: #4CAF50;
color: #fff;
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #3e8e41;
}
</style>
</head>
<body>
<form>
<label for="username">用户名</label>
<input type="text" id="username" name="username" required>
<label for="password">密码</label>
<input type="password" id="password" name="password" required>
<button type="submit">登录</button>
</form>
</body>
</html>
```
这段代码会生成一个简单的登录表单,包括用户名和密码的输入框,以及一个登录按钮。CSS 样式使得表单看起来更加美观,并且在用户输入不完整时会提示错误信息。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)