1、PHP运行原理
2、get
实例
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>get</title> <?php // echo "<pre>"; print_r($_GET); ?> </head> <body> <h2>用户登录</h2> <form action="" method="get"> <p> <label>邮箱:</label> <input type="email" name="email" value="<?=$_GET['email']?:'' ?>"> </p> <p> <label>密码:</label> <input type="password" name="password" value="<?=$_GET['password']?:'' ?>"> </p> <button>登录</button> </form> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例
运行预览
3、post
实例
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>post</title> <?php // echo "<pre>"; print_r($_POST); ?> </head> <body> <h2>用户登录</h2> <form action="" method="post"> <p> <label>邮箱:</label> <input type="email" name="email" value="<?=$_POST['email']?:'' ?>"> </p> <p> <label>密码:</label> <input type="password" name="password" value="<?=$_POST['password']?:'' ?>"> </p> <button>登录</button> </form> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例
运行预览
学习总结:
get传输数据小、post大
post适合传输一些机密信息,如账号、密码