PHP開發企業網站登入(一)
本節頁面為log.php
下面我們來看以下具體的程式碼:
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php 登录</title>
<style type="text/css">
*{margin: 0px;padding: 0px;}
body{background:#eee;}
.inpu{border-radius:10px;outline:none;width:200px;height:30px;border:1px solid red;
box-sizing:border-box;padding-left:15px;
}
#div{width:400px;height:400px;background:#B1FEF9;margin:0 auto;
margin-top:150px;border-radius:20px;}
h3{margin-left:88px;padding-top:60px;}
h4{margin-left:120px;padding-top:60px;font-size: 18px;}
#cnt{width:280px;height:370px;margin-left:33px;padding-top:60px;}
.sub{width:70px;height:30px;border:1px solid #fff;background:#eee;
margin-left:28px;margin-top:20px;}
.sub1{width:70px;height:30px;border:1px solid #fff;
background:#eee;margin-left:150px;margin-top:20px;}
</style>
</head>
<body>
<div id="div">
<h3>欢迎登陆后台管理系统</h3>
<div id="cnt">
<form method="post" action="login.php">
用户名:<input type="text" placeholder="请输入用户名" name="username" class="inpu">
<br><br>
密 码:<input type="password" placeholder="请输入密码" name="password" class="inpu">
<br><br>
<input type="submit" value="登录" class="sub">
</form>
</div>
</div>
</body>
</html>以上程式碼我們來看一下,然後大家看以下,表單提交到login.php
在這個文件上,我們打開了 session 是為了後面的需要所寫的,下一節我們將講解登錄這塊的處理
新建檔案
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php 登录</title>
<style type="text/css">
*{margin: 0px;padding: 0px;}
body{background:#eee;}
.inpu{border-radius:10px;outline:none;width:200px;height:30px;border:1px solid red;
box-sizing:border-box;padding-left:15px;
}
#div{width:400px;height:400px;background:#B1FEF9;margin:0 auto;
margin-top:150px;border-radius:20px;}
h3{margin-left:88px;padding-top:60px;}
h4{margin-left:120px;padding-top:60px;font-size: 18px;}
#cnt{width:280px;height:370px;margin-left:33px;padding-top:60px;}
.sub{width:70px;height:30px;border:1px solid #fff;background:#eee;
margin-left:28px;margin-top:20px;}
.sub1{width:70px;height:30px;border:1px solid #fff;
background:#eee;margin-left:150px;margin-top:20px;}
</style>
</head>
<body>
<div id="div">
<h3>欢迎登陆后台管理系统</h3>
<div id="cnt">
<form method="post" action="login.php">
用户名:<input type="text" placeholder="请输入用户名" name="username" class="inpu">
<br><br>
密 码:<input type="password" placeholder="请输入密码" name="password" class="inpu">
<br><br>
<input type="submit" value="登录" class="sub">
</form>
</div>
</div>
</body>
</html>
預覽
Clear
- 課程推薦
- 課件下載
課件暫不提供下載,工作人員正在整理中,後期請多關注該課程~ 





![ThinkPHP5快速開發企業網站[全程實錄]](https://img.php.cn/upload/course/000/000/068/6253d918a3ce7278.png)









