当前位置:首页>python>Python urllib HTTP请求指南

Python urllib HTTP请求指南

  • 2026-04-16 15:46:09
Python urllib HTTP请求指南

urllib 是 Python 标准库中用于处理 URL 的模块,包含 urllib.request(发送请求)、urllib.parse(URL 解析和编码)、urllib.error(异常处理)三个子模块。无需安装第三方库即可发送 HTTP 请求。

一、urllib.request 发送请求

1.1 urlopen() 简单请求

语法格式

urllib.request.urlopen(url, data=None, timeout=None, context=None)

参数说明

参数
说明
示例
url
URL 字符串或 Request 对象
'https://httpbin.org/get'
data
POST 数据,需编码为字节
b'key=value'
timeout
超时秒数
10
context
SSL 上下文
ssl.create_default_context()

返回值:返回一个类文件对象,包含 read()statusheaders 属性。

示例

import urllib.request# GET 请求with urllib.request.urlopen('https://httpbin.org/get'as response:    print(f"状态码: {response.status}")    print(f"响应内容: {response.read().decode('utf-8')}")# 输出# 状态码: 200# 响应内容: {"args": {}, "headers": {...}, "origin": "...", "url": "https://httpbin.org/get"}

1.2 Request 对象构建请求

语法格式

urllib.request.Request(url, data=None, headers={}, method=None)

参数说明

参数
说明
示例
url
请求 URL
'https://httpbin.org/post'
data
请求数据(字节)
b'key=value'
headers
请求头字典
{'User-Agent': 'MyBot'}
method
HTTP 方法
'GET'
'POST''PUT'

示例

import urllib.requestimport json# POST JSON 请求url = 'https://httpbin.org/post'data = json.dumps({'name''Alice''age'25}).encode('utf-8')req = urllib.request.Request(    url,    data=data,    headers={'Content-Type''application/json'},    method='POST')with urllib.request.urlopen(req) as response:    result = json.loads(response.read().decode('utf-8'))    print(f"服务器收到的JSON: {result['json']}")# 输出# 服务器收到的JSON: {'name': 'Alice', 'age': 25}

1.3 添加请求头

语法格式

Request.add_header(key, value)Request.add_unredirected_header(key, value)

说明add_header() 添加的请求头会跟随重定向,add_unredirected_header() 不会。

示例

import urllib.requestimport jsonreq = urllib.request.Request('https://httpbin.org/headers')req.add_header('User-Agent''MyApp/1.0')req.add_header('Accept''application/json')req.add_header('Referer''https://example.com')with urllib.request.urlopen(req) as response:    headers = json.loads(response.read().decode('utf-8'))['headers']    print(f"User-Agent: {headers.get('User-Agent')}")    print(f"Accept: {headers.get('Accept')}")# 输出# User-Agent: MyApp/1.0# Accept: application/json

1.4 设置代理

语法格式

urllib.request.ProxyHandler(proxies)urllib.request.build_opener(handler)

示例

import urllib.request# 设置代理proxies = {'http''http://proxy.example.com:8080','https''http://proxy.example.com:8080'}proxy_handler = urllib.request.ProxyHandler(proxies)opener = urllib.request.build_opener(proxy_handler)# 使用 opener 发送请求response = opener.open('https://httpbin.org/ip')print(response.read().decode('utf-8'))# 禁用代理(覆盖环境变量)no_proxy_handler = urllib.request.ProxyHandler({})opener_no_proxy = urllib.request.build_opener(no_proxy_handler)

1.5 build_opener() 自定义 opener

语法格式

urllib.request.build_opener(*handlers)urllib.request.install_opener(opener)

说明build_opener() 创建 opener,install_opener() 将其安装为全局默认。

示例

import urllib.request# 创建带有自定义处理器的 openeropener = urllib.request.build_opener()# 添加默认处理器(代理、Cookie、重定向等)classCustomHandler(urllib.request.BaseHandler):defdefault_open(self, req):        print(f"拦截请求: {req.full_url}")returnNone# 返回 None 继续执行其他处理器opener.add_handler(CustomHandler())# 全局安装后,urlopen() 将使用此 openerurllib.request.install_opener(opener)

1.6 HTTP 基本认证

语法格式

urllib.request.HTTPBasicAuthHandler()urllib.request.HTTPPasswordMgr()handler.add_password(realm, uri, user, password)

示例

import urllib.request# 创建密码管理器password_mgr = urllib.request.HTTPPasswordMgr()password_mgr.add_password(    realm='Fake Realm',    uri='https://httpbin.org/basic-auth/user/passwd',    user='user',    passwd='passwd')# 创建认证处理器auth_handler = urllib.request.HTTPBasicAuthHandler(password_mgr)opener = urllib.request.build_opener(auth_handler)# 发送请求response = opener.open('https://httpbin.org/basic-auth/user/passwd')print(f"状态码: {response.status}")print(response.read().decode('utf-8'))# 输出# 状态码: 200# {"authenticated": true, "user": "user"}

1.7 处理 Cookie

语法格式

urllib.request.HTTPCookieProcessor(cookiejar=None)

示例

import urllib.requestimport http.cookiejar# 创建 CookieJar 保存 Cookiecookie_jar = http.cookiejar.CookieJar()cookie_handler = urllib.request.HTTPCookieProcessor(cookie_jar)opener = urllib.request.build_opener(cookie_handler)# 第一次请求(登录)opener.open('https://httpbin.org/cookies/set/session_id/abc123')# 第二次请求(带 Cookie)opener.open('https://httpbin.org/cookies')# 查看 Cookiefor cookie in cookie_jar:    print(f"{cookie.name} = {cookie.value}")# 输出# session_id = abc123

1.8 urlretrieve() 下载文件

语法格式

urllib.request.urlretrieve(url, filename=None, reporthook=None, data=None)

参数说明

参数
说明
示例
url
下载链接
'https://httpbin.org/image/png'
filename
保存路径,None 则为临时文件
'/path/to/file'
reporthook
下载进度回调函数
hook_func
data
POST 数据
None

返回值:元组 (filename, headers)

示例

import urllib.request# 下载图片url = 'https://httpbin.org/image/png'local_filename, headers = urllib.request.urlretrieve(url, '/tmp/test.png')print(f"保存至: {local_filename}")print(f"文件大小: {headers.get('Content-Length')} bytes")# 清理临时文件urllib.request.urlcleanup()

二、urllib.parse URL 解析与编码

2.1 urlsplit() URL 分解

语法格式

urllib.parse.urlsplit(urlstring, scheme=None, allow_fragments=True)

返回值:SplitResult 命名元组

属性
说明
scheme
协议
netloc
网络位置(含端口)
path
路径
query
查询参数
fragment
片段标识符
hostname
主机名(仅主机)
port
端口号
username
用户名
password
密码

示例

from urllib.parse import urlspliturl = 'https://user:pass@example.com:8080/path?query=1#section'result = urlsplit(url)print(f"scheme: {result.scheme}")print(f"hostname: {result.hostname}")print(f"port: {result.port}")print(f"path: {result.path}")print(f"query: {result.query}")print(f"username: {result.username}")print(f"password: {result.password}")# 输出# scheme: https# hostname: example.com# port: 8080# path: /path# query: query=1# username: user# password: pass

2.2 urlparse() URL 分解(含 params)

语法格式

urllib.parse.urlparse(urlstring, scheme=None, allow_fragments=True)

返回值:ParseResult 命名元组,比 urlsplit 多一个 params 属性。

示例

from urllib.parse import urlparse# 注意:现代 URL 语法中 params 已很少使用url = 'http://example.com/path;params?query=1#frag'result = urlparse(url)print(f"scheme: {result.scheme}")print(f"netloc: {result.netloc}")print(f"path: {result.path}")print(f"params: {result.params}")  # 历史遗留字段print(f"query: {result.query}")# 输出# scheme: http# netloc: example.com# path: /path# params: params# query: query=1

2.3 urlencode() 查询参数编码

语法格式

urllib.parse.urlencode(query, doseq=False, safe='', quote_via=quote_plus)

参数说明

参数
说明
示例
query
字典或元组列表
{'name': 'Alice', 'age': 25}
doseq
序列值是否展开为多个参数
True
safe
不转义的字符
''
quote_via
编码函数
quote
(保留空格为 %20)

示例

from urllib.parse import urlencode, quote, quote_plus# 字典编码params = {'name''Alice''city''New York'}query_string = urlencode(params)print(f"urlencode: {query_string}")# 序列值展开params_multi = {'tag': ['python''http']}print(f"doseq=True: {urlencode(params_multi, doseq=True)}")# 使用 quote(空格转义为 %20)print(f"quote: {quote('hello world')}")# 使用 quote_plus(空格转义为 +)print(f"quote_plus: {quote_plus('hello world')}")# 输出# urlencode: name=Alice&city=New+York# doseq=True: tag=python&tag=http# quote: hello%20world# quote_plus: hello+world

2.4 quote() URL 编码

语法格式

urllib.parse.quote(string, safe='/', encoding=None, errors=None)urllib.parse.quote_plus(string, safe='', encoding=None, errors=None)

说明quote() 默认不编码 /quote_plus() 将空格转为 +

示例

from urllib.parse import quote, quote_plus, unquote, unquote_plus# 编码特殊字符text = '/path/to file?name=Alice&age=25'print(f"quote: {quote(text)}")print(f"quote_plus: {quote_plus(text)}")# 编码中文chinese = '你好世界'print(f"中文编码: {quote(chinese)}")# 解码encoded = 'hello%20world'print(f"unquote: {unquote(encoded)}")print(f"unquote_plus: {hello+world}")# 输出# quote: /path/to%20file?name%3DAlice&age%3D25# quote_plus: %2Fpath%2Fto+file%3Dname%3DAlice%26age%3D25# 中文编码: %E4%BD%A0%E5%A5%BD%E4%B8%96%E7%95%8C# unquote: hello world# unquote_plus: hello world

2.5 parse_qs() 查询字符串解析

语法格式

urllib.parse.parse_qs(qs, keep_blank_values=False, encoding='utf-8')urllib.parse.parse_qsl(qs, keep_blank_values=False, encoding='utf-8')

返回值parse_qs 返回字典,parse_qsl 返回列表。

示例

from urllib.parse import parse_qs, parse_qslquery_string = 'name=Alice&age=25&city=NYC&tag=python&tag=http'# 返回字典print(f"parse_qs: {parse_qs(query_string)}")# 返回列表print(f"parse_qsl: {parse_qsl(query_string)}")# 保留空值query_with_blank = 'name=Alice&age=&city=NYC'print(f"保留空值: {parse_qs(query_with_blank, keep_blank_values=True)}")# 输出# parse_qs: {'name': ['Alice'], 'age': ['25'], 'city': ['NYC'], 'tag': ['python', 'http']}# parse_qsl: [('name', 'Alice'), ('age', '25'), ('city', 'NYC'), ('tag', 'python'), ('tag', 'http')]# 保留空值: {'name': ['Alice'], 'age': [''], 'city': ['NYC']}

2.6 urljoin() URL 拼接

语法格式

urllib.parse.urljoin(base, url, allow_fragments=True)

说明:基于 base URL 拼接相对 URL。

示例

from urllib.parse import urljoinbase = 'https://example.com/path/page.html'# 相对路径print(f"相对路径: {urljoin(base, 'about.html')}")# 绝对路径print(f"绝对路径: {urljoin(base, '/about.html')}")# 绝对 URLprint(f"绝对URL: {urljoin(base, 'https://other.com/page')}")# 上级目录print(f"上级目录: {urljoin(base, '../contact.html')}")# 输出# 相对路径: https://example.com/path/about.html# 绝对路径: https://example.com/about.html# 绝对URL: https://other.com/page# 上级目录: https://example.com/contact.html

2.7 urlunsplit() URL 拼接(反向)

语法格式

urllib.parse.urlunsplit(parts)

说明:将 urlsplit 结果重新组合为 URL。

示例

from urllib.parse import urlsplit, urlunspliturl = 'https://example.com/path?query=1#section'parts = urlsplit(url)# 修改部分组件new_parts = (parts.scheme, parts.netloc, '/newpath', parts.query, '')new_url = urlunsplit(new_parts)print(f"新URL: {new_url}")# 输出# 新URL: https://example.com/newpath?query=1

2.8 urldefrag() 分离片段

语法格式

urllib.parse.urldefrag(url)

返回值:DefragResult 命名元组 (url, fragment)

示例

from urllib.parse import urldefragurl = 'https://example.com/page#section1'base_url, fragment = urldefrag(url)print(f"基础URL: {base_url}")print(f"片段: {fragment}")# 输出# 基础URL: https://example.com/page# 片段: section1

三、urllib.error 异常处理

3.1 URLError 网络错误

语法格式

urllib.error.URLError(reason)

说明:网络连接问题的基类异常,reason 属性包含具体错误信息。

示例

import urllib.requestimport urllib.errortry:    urllib.request.urlopen('https://invalid-domain-12345.com', timeout=5)except urllib.error.URLError as e:    print(f"错误类型: {type(e.reason)}")    print(f"错误信息: {e.reason}")# 输出(可能)# 错误类型: <class 'socket.gaierror'># 错误信息: [Errno -2] Name or service not known

3.2 HTTPError HTTP 错误

语法格式

urllib.error.HTTPError(url, code, msg, hdrs, fp)

属性说明

属性
说明
code
HTTP 状态码
reason
错误原因描述
headers
响应头
url
请求 URL

示例

import urllib.requestimport urllib.errorimport jsontry:# 请求一个不存在的路径    urllib.request.urlopen('https://httpbin.org/status/404', timeout=5)except urllib.error.HTTPError as e:    print(f"状态码: {e.code}")    print(f"原因: {e.reason}")    print(f"URL: {e.url}")# 读取错误响应体try:        error_body = json.loads(e.read().decode('utf-8'))        print(f"响应内容: {error_body}")except:pass# 输出# 状态码: 404# 原因: NOT FOUND# URL: https://httpbin.org/status/404

3.3 异常处理流程

示例

import urllib.requestimport urllib.errordeffetch_url(url):"""统一的异常处理示例"""try:with urllib.request.urlopen(url, timeout=10as response:return {'status': response.status,'data': response.read().decode('utf-8')            }except urllib.error.HTTPError as e:# HTTP 错误(4xx, 5xx)return {'error''HTTP_ERROR','code': e.code,'reason': e.reason        }except urllib.error.URLError as e:# 网络错误(连接失败、超时等)return {'error''URL_ERROR','reason': str(e.reason)        }except Exception as e:# 其他错误return {'error''UNKNOWN','reason': str(e)        }# 测试print(fetch_url('https://httpbin.org/get'))print(fetch_url('https://httpbin.org/status/500'))print(fetch_url('https://invalid-domain.com'))# 输出# {'status': 200, 'data': '{...}'}# {'error': 'HTTP_ERROR', 'code': 500, 'reason': 'INTERNAL SERVER ERROR'}# {'error': 'URL_ERROR', 'reason': '...'}

四、完整请求示例

4.1 GET 请求

import urllib.requestdefget_request(url, params=None, headers=None):"""发送 GET 请求"""if params:from urllib.parse import urlencode        url = f"{url}?{urlencode(params)}"    req = urllib.request.Request(url)if headers:for key, value in headers.items():            req.add_header(key, value)with urllib.request.urlopen(req) as response:return {'status': response.status,'headers': dict(response.headers),'body': response.read().decode('utf-8')        }# 使用result = get_request('https://httpbin.org/get',    params={'key''value'},    headers={'Accept''application/json'})print(f"状态: {result['status']}")

4.2 POST 请求

import urllib.requestimport urllib.parseimport jsondefpost_request(url, data=None, json_data=None, headers=None):"""发送 POST 请求"""if json_data:        data = json.dumps(json_data).encode('utf-8')        content_type = 'application/json'elif data:if isinstance(data, dict):            data = urllib.parse.urlencode(data).encode('utf-8')else:            data = data.encode('utf-8')        content_type = 'application/x-www-form-urlencoded'    req = urllib.request.Request(url, data=data)    req.add_header('Content-Type', content_type)if headers:for key, value in headers.items():            req.add_header(key, value)with urllib.request.urlopen(req) as response:return {'status': response.status,'body': json.loads(response.read().decode('utf-8'))        }# 使用result = post_request('https://httpbin.org/post',    json_data={'name''Alice''age'25})print(f"服务器响应: {result['body']['json']}")# 输出# 服务器响应: {'name': 'Alice', 'age': 25}

4.3 文件上传

import urllib.requestimport urllib.parseimport jsondefupload_file(url, field_name, file_content, filename, extra_fields=None):"""上传文件(multipart/form-data)"""    boundary = '----WebKitFormBoundary7MA4YWxkTrZu0gW'    body = b''# 添加额外字段if extra_fields:for key, value in extra_fields.items():            body += f'--{boundary}\r\n'.encode()            body += f'Content-Disposition: form-data; name="{key}"\r\n\r\n'.encode()            body += f'{value}\r\n'.encode()# 添加文件字段    body += f'--{boundary}\r\n'.encode()    body += f'Content-Disposition: form-data; name="{field_name}"; filename="{filename}"\r\n'.encode()    body += b'Content-Type: application/octet-stream\r\n\r\n'    body += file_content    body += b'\r\n'# 结束边界    body += f'--{boundary}--\r\n'.encode()    req = urllib.request.Request(url, data=body)    req.add_header('Content-Type'f'multipart/form-data; boundary={boundary}')with urllib.request.urlopen(req) as response:return json.loads(response.read().decode('utf-8'))# 使用result = upload_file('https://httpbin.org/post',    field_name='file',    file_content=b'Hello, this is file content!',    filename='test.txt',    extra_fields={'description''A test file'})print(f"上传成功: {result['files']}")

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-04-17 12:03:31 HTTP/2.0 GET : https://f.mffb.com.cn/a/485322.html
  2. 运行时间 : 0.104175s [ 吞吐率:9.60req/s ] 内存消耗:4,639.34kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=4cbead6a996cffc87f666f63e8ffac97
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000659s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000826s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000374s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000304s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000586s ]
  6. SELECT * FROM `set` [ RunTime:0.000258s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000799s ]
  8. SELECT * FROM `article` WHERE `id` = 485322 LIMIT 1 [ RunTime:0.000607s ]
  9. UPDATE `article` SET `lasttime` = 1776398611 WHERE `id` = 485322 [ RunTime:0.010110s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000396s ]
  11. SELECT * FROM `article` WHERE `id` < 485322 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000674s ]
  12. SELECT * FROM `article` WHERE `id` > 485322 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001454s ]
  13. SELECT * FROM `article` WHERE `id` < 485322 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.004814s ]
  14. SELECT * FROM `article` WHERE `id` < 485322 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.001261s ]
  15. SELECT * FROM `article` WHERE `id` < 485322 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.002712s ]
0.105855s