HTTP
一句话解释
HTTP (HyperText Transfer Protocol) 是设置的 规则浏览器 and 服务器 use 到请求 and 发送 web resources.
用大白话说
HTTP 是the language of the web。 When you type a URL or click a link, your browser sends an HTTP request to a server. The server processes the request and sends back an HTTP response — usually an HTML page, an image, JSON data, or an error code.
每个HTTP message has a method (what you want to do), a URL (what you want it done to), headers (metadata), and an optional body. The most common methods are GET (fetch a resource), POST (submit data), PUT (replace a resource), and DELETE (remove a resource).
HTTPS is the secure version of HTTP — the same protocol but encrypted with TLS. Every response carries a status code: 200 means success, 404 means not found, 500 means server error. Understanding these codes helps you debug web applications.
示例
GET /users/42 HTTP/1.1
Host: api.example.com
Accept: application/json
---
HTTP/1.1 200 OK
Content-Type: application/json
{ "id": 42, "name": "Ada" }GET 请求 for /用户/42 and 服务器's 200 OK 响应使用 JSON 请求体.
工作原理
- The browser sends an HTTP request with a method (GET/POST/...), URL, and headers.
- The server processes the request and finds the requested resource.
- The server returns an HTTP response with a status code, headers, and body.
- The browser renders the response (HTML) or hands it to JavaScript (JSON).
相关术语
相关资源
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。