本站改版新增arduino频道
HTTP content-type
Content-Type(内容类型),一般是指网页中存在的 Content-Type,用于定义网络文件的类型和网页的编码,决定浏览器将以什么形式、什么编码读取这个文件,这就是经常看到一些 PHP 网页点击的结果却是下载一个文件或一张图片的原因。
Content-Type 标头告诉客户端实际返回的内容的内容类型。
语法格式:
Content-Type: text/html; charset=utf-8
Content-Type: multipart/form-data; boundary=something
def get_content_type(ext):
if ext == 'jpg':
return 'image/jpeg'
elif ext == 'png':
return 'image/png'
elif ext == 'css':
return 'text/css'
elif ext == 'js':
return 'text/javascript'
elif ext == 'txt':
return 'text/plain'
elif ext == 'mp3':
return 'audio/mpeg'
elif ext == 'wav':
return 'audio/wav'
elif ext == 'cur' or ext == 'ico':
return 'image/x-icon'
else:
return 'text/html; charset=UTF-8'
print(get_content_type('jpg'))
Copyright © 2014 ESP56.com All Rights Reserved
晋ICP备14006235号-22 晋公网安备14108102001165号
执行时间: 0.0096378326416016 seconds