<!DOCTYPE html>
<html>
<head>
<title>HTML POST and GET Example</title>
</head>
<body>
<h2>Using GET</h2>
<form action="/submit_get" method="get">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="submit" value="Submit">
</form>
<p>When the form is submitted, the URL will contain the form data as parameters.</p>
<h2>Using POST</h2>
<form action="/submit_post" method="post">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="submit" value="Submit">
</form>
<p>When the form is submitted, the form data will be sent in the body of the HTTP request.</p>
</body>
</html>
GET 方法:
<form action="/submit_get" method="get"> 定义了一个表单,当用户提交表单时,数据会通过 URL 参数传递给服务器。John 和 Doe 并提交表单,URL 将变为 /submit_get?fname=John&lname=Doe。POST 方法:
<form action="/submit_post" method="post"> 定义了一个表单,当用户提交表单时,数据会包含在 HTTP 请求的主体中发送到服务器。这两种方法各有优缺点,选择使用哪种方法取决于具体的应用场景。
上一篇:html 语法
下一篇:html url
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站