python3中http协议提供文件服务器功能

news2024/9/20 17:16:27

http协议是互联网的通用基础协议,也可以利用其来开发文件服务器,给客户提供文件浏览,查看,下载,上传等功能。

目录

1.python3自带http文件服务

 2.python3从头开发http文件服务


1.python3自带http文件服务

python3中http.server提供http文件服务,默认端口是8000,可以进行修改

运行命令:

python3 -m http.server 12567

另外python2中可以使用SimpleHTTPServer来提供http文件服务,默认端口是8000,ye可以进行修改

运行命令:

python -m SimpleHTTPServer 12567
运行效果如下:

 

 2.python3从头开发http文件服务

http_server.py

# -*- coding: UTF-8 -*-

import os, time
import sys, socket
import posixpath
#escape:逃跑,用来让特殊符号表示它本来的意思
try:
    from html import escape
except ImportError:
    from cgi import escape
import shutil
import mimetypes
import re
import signal
from io import StringIO, BytesIO
import codecs
from urllib.parse import quote
from urllib.parse import unquote
import urllib.parse
from http.server import HTTPServer
from http.server import BaseHTTPRequestHandler

"""urlencode quote unquote
urllib.parse.urlencode
urlencode函数,可以把key-value这样的键值对转换成我们想要的格式,返回的是a=1&b=2这样的字符串
urllib.parse.quote
quote对一个字符串进行urlencode转换
urllib.parse.unquote
unquote与quote对应,用来解码quote处理后的结果
"""

"""内存IO之StringIO和BytesIO
参考博客:
https://zhuanlan.zhihu.com/p/332651899
"""

"""HTTPServer
参考博客
    https://www.cnblogs.com/jason-huawen/p/16241405.html
"""
"""
浏览器运行:
    http://127.0.0.1:18081
"""

class MyHTTPRequestHandler(BaseHTTPRequestHandler):
    address = socket.gethostbyname(socket.gethostname())
    treefile = "sesssion_cache.txt"
    mylist = []
    myspace = ""
       
    def do_GET(self):
        """处理GET请求
        """
        print(MyHTTPRequestHandler.address)
        paths = unquote(self.path)
        path = str(paths)
        print("path is ", paths, path)
        '''
        self.send_error(404, "File not found")
        '''
        if self.remove_dir_or_file(path):
            return
        fd = self.send_head()
        if fd:
            #关键代码: self.wfile用来向客户端写入数据
            shutil.copyfileobj(fd, self.wfile)
            if path == "/":
                self.traversal_file(translate_path(self.path))
                self.write_list(MyHTTPRequestHandler.treefile)
            fd.close()
            
    def do_HEAD(self):
        """处理HEAD请求
        """
        fd = self.send_head()
        if fd:
            fd.close()
    
    def do_POST(self):
        """处理POST请求
        """
        r, info = self.deal_post_data()
        #拼装HTML文本
        f = BytesIO()
        f.write(b'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">')
        f.write(b"<html>\n<title>Upload Result Page</title>\n")
        f.write(b"<body>\n<h2>Upload Result Page</h2>\n")
        f.write(b"<hr>\n")
        if r:
            f.write(b"<strong>Success:</strong><br>")
        else:
            f.write(b"<strong>Failed:</strong><br>")

        for i in info:
            print(r, i, "by: ", self.client_address)
            f.write(i.encode('utf-8')+b"<br>")
        f.write(b"<br><a href=\"%s\">back</a>" % self.headers['referer'].encode('ascii'))
        f.write(b"</body>\n</html>\n")
        length = f.tell()
        f.seek(0)
        self.send_response(200)
        self.send_header("Content-type", "text/html;charset=utf-8")
        self.send_header("Content-Length", str(length))
        self.end_headers()
        if f:
            shutil.copyfileobj(f, self.wfile)
            f.close()
        #每次提交post请求之后更新目录树文件
        self.p(translate_path(self.path))
        self.write_list(MyHTTPRequestHandler.treefile)
    
    def str_to_chinese(self,var):
        not_end = True
        while not_end:
            start1 = var.find("\\x")
            # print start1
            if start1 > -1:
                str1 = var[start1 + 2:start1 + 4]
                print(str1)
                start2 = var[start1 + 4:].find("\\x") + start1 + 4
                if start2 > -1:
                    str2 = var[start2 + 2:start2 + 4]

                    start3 = var[start2 + 4:].find("\\x") + start2 + 4
                    if start3 > -1:
                        str3 = var[start3 + 2:start3 + 4]
            else:
                not_end = False
            if start1 > -1 and start2 > -1 and start3 > -1:
                str_all = str1 + str2 + str3
                # print str_all
                str_all = codecs.decode(str_all, "hex").decode('utf-8')

                str_re = var[start1:start3 + 4]
                # print str_all, "   " ,str_re
                var = var.replace(str_re, str_all)
        # print var.decode('utf-8')
        return var
    
    def deal_post_data(self):
        boundary = self.headers["Content-Type"].split("=")[1].encode('ascii')
        print("boundary===", boundary)
        remain_bytes = int(self.headers['content-length'])
        print("remain_bytes===", remain_bytes)

        res = []
        line = self.rfile.readline()
        while boundary in line and str(line, encoding = "utf-8")[-4:] != "--\r\n":
            
            #line = self.rfile.readline()
            remain_bytes -= len(line)
            if boundary not in line:
                return False, "Content NOT begin with boundary"
            line = self.rfile.readline()
            remain_bytes -= len(line)
            print("line!!!",line)
            fn = re.findall(r'Content-Disposition.*name="file"; filename="(.*)"', str(line))
            if not fn:
                return False, "Can't find out file name..."
            path = translate_path(self.path)

            fname = fn[0]
            #fname = fname.replace("\\", "\\\\")
            fname = self.str_to_chinese(fname)
            print("------",fname)
            
            fn = os.path.join(path, fname)
            while os.path.exists(fn):
                fn += "_"
            print("!!!!",fn)
            dirname = os.path.dirname(fn)
            if not os.path.exists(dirname):
                os.makedirs(dirname)
            line = self.rfile.readline()
            remain_bytes -= len(line)
            line = self.rfile.readline()
            # b'\r\n'
            remain_bytes -= len(line)
            try:
                out = open(fn, 'wb')
            except IOError:
                return False, "Can't create file to write, do you have permission to write?"

            pre_line = self.rfile.readline()
            print("pre_line", pre_line)
            remain_bytes -= len(pre_line)
            print("remain_bytes", remain_bytes)
            Flag = True
            while remain_bytes > 0:
                line = self.rfile.readline()
                print("while line", line)
                
                if boundary in line:
                    remain_bytes -= len(line)
                    pre_line = pre_line[0:-1]
                    if pre_line.endswith(b'\r'):
                        pre_line = pre_line[0:-1]
                    out.write(pre_line)
                    out.close()
                    res.append("File '%s' upload success!" % fn)
                    Flag = False
                    break
                else:
                    out.write(pre_line)
                    pre_line = line
            if pre_line is not None and Flag == True:
                out.write(pre_line)
                out.close()
                res.append("File '%s' upload success!" % fn)
        return True, res
    
    def remove_dir_or_file(self, path):
        plist = path.split("/", 2)
        print("plist plist plist plist ", plist)
        if len(plist) > 2 and plist[1] == "delete":
            #路径转化
            file = translate_path(plist[2])
            print("======>>>>>>>>>> file", file)
            if os.path.exists(file):
                fdir = os.path.dirname(file)
                print("======>>>>>>>>>> ", file, fdir)
                #删除文件
                os.remove(file)
                if not os.listdir(fdir):
                    #删除目录
                    os.removedirs(fdir)
                time.sleep(0.5)
                # 0.5s后重定向
                self.send_response(302)
                self.send_header('Location', "/")
                self.end_headers()
                return True
            print("======>>>>>>>>>> file not exists ", file)
        return False
            
    def send_head(self):
        """发送HTTP头
        """
        path = translate_path(self.path)
        if os.path.isdir(path):
            if not self.path.endswith('/'):
                # redirect browser - doing basically what apache does
                self.send_response(301)
                self.send_header("Location", self.path + "/")
                self.end_headers()
                return None
            for index in "index.html", "index.htm":
                index = os.path.join(path, index)
                if os.path.exists(index):
                    path = index
                    break
            else:
                return self.list_directory(path)
        print("=================================")
        content_type = self.guess_type(path)
        try:
            # Always read in binary mode. Opening files in text mode may cause
            # newline translations, making the actual size of the content
            # transmitted *less* than the content-length!
            f = open(path, 'rb')
        except IOError:
            self.send_error(404, "File not found")
            return None
        self.send_response(200)
        self.send_header("Content-type", content_type)
        fs = os.fstat(f.fileno())
        self.send_header("Content-Length", str(fs[6]))
        self.send_header("Last-Modified", self.date_time_string(fs.st_mtime))
        self.end_headers()
        return f
    
    def list_directory(self, path):
        """Helper to produce a directory listing (absent index.html).
        Return value is either a file object, or None (indicating an
        error).  In either case, the headers are sent, making the
        interface the same as for send_head().
        """
        try:
            list_dir = os.listdir(path)
        except os.error:
            self.send_error(404, "No permission to list directory")
            return None
        list_dir.sort(key=lambda a: a.lower())
        f = BytesIO()
        display_path = escape(unquote(self.path))
        f.write(b'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">')
        f.write(b"<html>\n<title>Directory listing for %s</title>\n" % display_path.encode('ascii'))
        f.write(b"<body>\n<h2>Directory listing for %s</h2>\n" % display_path.encode('ascii'))
        f.write(b"<hr>\n")
        #上传目录
        f.write(b"<h3>Directory Updating</h3>\n")
        f.write(b"<form ENCTYPE=\"multipart/form-data\" method=\"post\">")
        #@change=\"handleChange\" @click=\"handelClick\"
        f.write(b"<input ref=\"input\" webkitdirectory multiple name=\"file\" type=\"file\"/>")
        f.write(b"<input type=\"submit\" value=\"uploadDir\"/></form>\n")
        f.write(b"<hr>\n")
        #上传文件
        f.write(b"<h3>Files Updating</h3>\n")
        f.write(b"<form ENCTYPE=\"multipart/form-data\" method=\"post\">")
        f.write(b"<input ref=\"input\" multiple name=\"file\" type=\"file\"/>")
        f.write(b"<input type=\"submit\" value=\"uploadFiles\"/></form>\n")

        f.write(b"<hr>\n")
        #表格
        f.write(b"<table with=\"100%\">")
        f.write(b"<tr><th>path</th>")
        f.write(b"<th>size(Byte)</th>")
        f.write(b"<th>modify time</th>")
        f.write(b"</tr>")

        # 根目录下所有的内容
        for name in list_dir:
            # 根目录下的路径
            fullname = os.path.join(path, name)
            # 目录名/文件名
            display_name = linkname = name
            print("display_name ==> ", display_name)
            if display_name.upper() == "HTTP_SERVER.PY":
                continue

            # 如果是文件夹的话
            if os.path.isdir(fullname):
                # 遍历文件夹
                for root, dirs, files in os.walk(fullname):
                # root 表示当前正在访问的文件夹路径
                # dirs 表示该文件夹下的子目录名list
                # files 表示该文件夹下的文件list
                    # 遍历文件
                    for fi in files:
                        print("########", os.path.join(root, fi))
                        display_name = os.path.join(root, fi)
                        #删除前面的xx个字符,取出相对路径
                        relativePath = display_name[len(os.getcwd()):].replace('\\','/')
                        st = os.stat(display_name)
                        fsize = st.st_size
                        fmtime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(st.st_mtime))
                        f.write(b"<tr>")
                        f.write(b'<td><a href="%s">%s</a></td>' % (quote(relativePath).encode('utf-8'), escape(relativePath).encode('utf-8')))
                        f.write(b"<td>%d</td>" % fsize)
                        f.write(b"<td>%s</td>" % escape(fmtime).encode('ascii'))
                        f.write(b"<td><a href=\"/delete/%s\">delete</a>" % escape(relativePath).encode('utf-8'))
                        f.write(b"</tr>")
                
                    # 遍历所有的文件夹名字,其实在上面walk已经遍历过了
                    # for d in dirs:
                    #     print(d)
                        
            # 如果是链接文件
            elif os.path.islink(fullname):
                linkname = linkname + "/"
                print("real===", linkname)
                display_name = name + "@"
                # Note: a link to a directory displays with @ and links with /
                f.write(b'<li><a href="%s">%s</a>\n' % (quote(linkname).encode('ascii'), escape(display_name).encode('ascii')))
            
            else:
                #其他直接在根目录下的文件直接显示出来
                st = os.stat(display_name)
                fsize = st.st_size
                fmtime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(st.st_mtime))
                f.write(b"<tr>")
                f.write(b'<td><a href="%s">%s</a></td>' % (quote(linkname).encode('utf-8'), escape(display_name).encode('utf-8')))
                f.write(b"<td>%d</td>" % fsize)
                f.write(b"<td>%s</td>" % escape(fmtime).encode('ascii'))
                f.write(b"<td><a href=\"/delete/%s\">delete</a>" % escape(display_name).encode('utf-8'))
                f.write(b"</tr>")

        f.write(b"</table>")
        f.write(b"\n<hr>\n</body>\n</html>\n")
        length = f.tell()
        f.seek(0)
        self.send_response(200)
        self.send_header("Content-type", "text/html;charset=utf-8")
        self.send_header("Content-Length", str(length))
        self.end_headers()
        return f

    def guess_type(self, path):
        """Guess the type of a file.
        Argument is a PATH (a filename).
        Return value is a string of the form type/subtype,
        usable for a MIME Content-type header.
        The default implementation looks the file's extension
        up in the table self.extensions_map, using application/octet-stream
        as a default; however it would be permissible (if
        slow) to look inside the data to make a better guess.
        """

        base, ext = posixpath.splitext(path)
        if ext in self.extensions_map:
            return self.extensions_map[ext]
        ext = ext.lower()
        if ext in self.extensions_map:
            return self.extensions_map[ext]
        else:
            return self.extensions_map['']

    if not mimetypes.inited:
        mimetypes.init()  # try to read system mime.types
    extensions_map = mimetypes.types_map.copy()
    extensions_map.update({
            '': 'application/octet-stream',  # Default
            '.py': 'text/plain',
            '.c': 'text/plain',
            '.h': 'text/plain',
        })
        
    def traversal_file(self, url):
        print("url:", url)
        files = os.listdir(r''+url)
        for file in files:           
            myfile = url + "//" + file
            size = os.path.getsize(myfile)
            if os.path.isfile(myfile):
                MyHTTPRequestHandler.mylist.append(str(MyHTTPRequestHandler.myspace)+"|____"+file +" "+ str(size)+"\n")
            
            if os.path.isdir(myfile) :
                MyHTTPRequestHandler.mylist.append(str(MyHTTPRequestHandler.myspace)+"|____"+file + "\n")
                #get into the sub-directory,add "|    "
                MyHTTPRequestHandler.myspace = MyHTTPRequestHandler.myspace+"|    "
                self.traversal_file(myfile)
                #when sub-directory of iteration is finished,reduce "|    "
                MyHTTPRequestHandler.myspace = MyHTTPRequestHandler.myspace[:-5]
                
    def get_all_file_list(self):
        listofme = []
        for root, dirs, files in os.walk(translate_path(self.path)):
            files.sort()
            for fi in files:
                display_name = os.path.join(root, fi)
                #删除前面的XXX个字符,取出相对当前目录的路径
                relativePath = display_name[len(os.getcwd()):].replace('\\','/')
                st = os.stat(display_name)
                fsize = st.st_size
                fmtime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(st.st_mtime))
                listofme.append(relativePath+"\t")
                listofme.append(str(fsize)+"\t")
                listofme.append(str(fmtime)+"\t\n")
        return listofme
    
    def write_list(self,url):
        f = open(url,'w')
        f.write("http://"+str(MyHTTPRequestHandler.address)+":8001/ directory tree\n")
        MyHTTPRequestHandler.mylist.sort()
        f.writelines(MyHTTPRequestHandler.mylist)
        f.write("\nFile Path\tFile Size\tFile Modify Time\n")
        f.writelines(self.get_all_file_list())
        MyHTTPRequestHandler.mylist = []
        MyHTTPRequestHandler.myspace = ""
        f.close()
        print("write_list end")

def translate_path(path):
    path = path.split('?', 1)[0]
    path = path.split('#', 1)[0]
    path = posixpath.normpath(unquote(path))
    words = path.split('/')
    words = filter(None, words)
    path = os.getcwd()
    for word in words:
        drive, word = os.path.splitdrive(word)
        head, word = os.path.split(word)
        if word in (os.curdir, os.pardir):
            continue
        path = os.path.join(path, word)
    return path
       
def signal_handler(signal, frame):
    print(signal, frame)
    exit()


def main():
    print('python version:', sys.version_info.major, sys.version_info.minor)
    if sys.argv[1:]:
        port = int(sys.argv[1])
    else:
        port = 18081
    #server_address = ('', port)
    address = ('127.0.0.1', port)

    signal.signal(signal.SIGINT, signal_handler)
    signal.signal(signal.SIGTERM, signal_handler)
    signal.signal(signal.SIGQUIT, signal_handler)
    #忽略ctrl+z:SIGTSTP(挂起信号)
    signal.signal(signal.SIGTSTP, signal.SIG_IGN)

    server = HTTPServer(address, MyHTTPRequestHandler)
    server_info = server.socket.getsockname()
    print("server info: " + str(server_info[0]) + ", port: " + str(server_info[1]) + " ...")
    server.serve_forever()

def test_url_code():
    values = {'username': 'hello 你好', 'password': 'pass'}
    data = urllib.parse.urlencode(values)
    print("data = ", data)
    
    name = '狄仁杰'
    name = urllib.parse.quote(name)
    print("name = ", name)

    dname = urllib.parse.unquote(name)
    print("dname = " + dname)
    
if __name__ == '__main__':
    test_url_code()
    main()

运行效果如下:

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/691115.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

资源调度框架 YARN

3.1.1 什么是YARN Yet Another Resource Negotiator, 另一种资源协调者通用资源管理系统为上层应用提供统一的资源管理和调度&#xff0c;为集群在利用率、资源统一管理和数据共享等方面带来了巨大好处 3.1.2 YARN产生背景 通用资源管理系统 Hadoop数据分布式存储&#xff08…

【打杂记录】-能否开发一个报账系统,自动批量识别与完成报账任务?

能否开发一个报账系统&#xff0c;自动批量识别与完成报账任务&#xff1f; 今天这篇博客&#xff0c;我想说些非技术性语言。我在研二一年负责实验室的报账工作&#xff0c;近期终于有机会将工作交接给下一位负责人&#xff0c;我的科研时间又回来了。 在这一年里&#xff0c…

centos7 挂载未分配的空间新增卷

一、系统环境 操作系统&#xff1a;Centos 7 已配置环境&#xff1a;空 二、磁盘挂载到新目录&#xff08;磁盘挂载&#xff09; 2.1 查找新硬盘 查看机器所挂硬盘及分区情况&#xff1a; fdisk -l 复制 红框圈中的即是本次要挂载的磁盘&#xff0c;与 /dev/sda 和 /de…

掌握多线程的用法一篇就够了

多线程 线程与进程进程线程线程调度速度问题 创建线程的方式第一种:继承Thread类原理分析 第二种:实现Runnable接口的形式第三种&#xff1a;有返回值的线程 Thread类的方法Thread和Runnable的区别线程安全问题举例测试代码线程安全问题分析案例解决办法分析方案一:使用同步代…

SpringSecurity基础入门详解

【1】SpringSecurity是什么 Spring 是非常流行和成功的 Java 应用开发框架&#xff0c;Spring Security正是Spring家族中的成员。Spring Security 基于 Spring 框架&#xff0c;提供了一套 Web 应用安全性的完整解决方案。 正如你可能知道的关于安全方面的两个主要区域是“认…

使用英特尔 oneAPI AI 工具分析包实现AI应用程序的调试与改进

目录 1.什么是英特尔 oneAPI AI&#xff1f; 关于英特尔 oneAPI AI 工具分析包 2.使用英特尔 oneAPI AI 工具分析包实现AI数据分析 准备工作 数据准备 编写AI应用程序 性能分析 并行性优化 内存和线程错误分析 优化AI算法 性能验证与调试 性能优化迭代 3.总结 1.什…

「2024」预备研究生mem-概率基础加法公式乘法公式古典概型基础

一、概率基础 二、加法公式 三、乘法公式&古典概型基础 均不是1点 除了不是1的概率 不全是1点&#xff1a;也有可能是1点&#xff0c; 理解为 对是1点取非 相互独立 相乘 古典概型&#xff1a; 从A出发&#xff0c;先到B&#xff0c; 先到D&#xff0c;先到C&#xff08;…

记录字符串压缩

参考代码 class Solution { public:string num2str(int val){string ans;while(val/10){ans.push_back((char)(0val%10));val/10;}ans.push_back((char)(0val%10));return ans;}string compressString(string S) {string ssS;S.push_back(\n);int left0,right1;int n S.size(…

数字孪生场景渲染能力中的WebGL技术路线

使用三维建模技术构建出的虚拟现实场景后&#xff0c;需要通过渲染引擎实现场景的高精度、高保真和实时渲染。同时&#xff0c;需要将现实场景中的数据信息融合到虚拟场景中&#xff0c;实现对现实情况的监测和控制。 目前大多数数字孪生城市项目在三维渲染引擎的技术选型上通…

高性能哈希算法MurmurHash

参考链接&#xff1a; https://blog.51cto.com/u_15127622/3264772 md5算法_十分钟掌握高性能哈希算法MurmurHash_weixin_39616339的博客-CSDN博客 Murmur哈希算法 一种非加密型哈希算法&#xff0c;适用于一般的哈希检索操作&#xff0c;由Austin Appleby创建于2008年。 …

Nat.Commun.:展示了首个硅量子光源!

光子盒研究院 量子技术有望通过启用全新的通信、传感和计算方法来彻底改变社会。例如&#xff0c;量子密码学如果能够实现&#xff0c;将为抵御黑客提供无与伦比的数据安全水平&#xff1a;这是因为量子信息可以在光子&#xff08;单个光粒子&#xff09;中进行编码、无法被复制…

以数为帆,乘风破浪!数据治理与应用沙龙在广州成功举办

DCMM作为国家第一个数据管理领域标准&#xff0c;是企业落实数据驱动战略、实现数字化转型的重要抓手。当下每个企业都必须有自己的数字化转型战略&#xff0c;而数据治理和数字化转型是同生共伴的&#xff0c;DCMM可以为企业进行数据治理提供全面的模型指导和方法体系。 6月2…

精选Golang高频面试题和答案汇总

大家好&#xff0c;我是阳哥。 之前写的《 GO必知必会面试题汇总》&#xff0c;已经阅读破万&#xff0c;收藏230。 也欢迎大家收藏、转发本文。 这篇文章给大家整理了17道Go语言高频面试题和答案详解&#xff0c;每道题都给出了代码示例&#xff0c;方便大家更好的理解。 1…

输入数据时全连接层计算量是多少

假设是这样的 那么计算公式是这样的 [ a 1 a 2 a 3 ] [ W 11 W 12 W 21 W 22 W 31 W 32 ] [ x 1 x 2 ] [ b 1 b 2 b 3 ] \left[\begin{array}{l} a_1 \\ a_2 \\ a_3 \end{array}\right]\left[\begin{array}{ll} W_{11} & W_{12} \\ W_{21} & W_{22} \\ W_{31} &…

关于uCOSiii使用__get_MSP()返回主堆栈指针的当前值出现的问题

关于uCOSiii使用__get_MSP()返回主堆栈指针的当前值出现的问题 我的uCOSiii的版本是: V3.03.01 void STACK_Init(void) { Used_STACK_SIZE0; STACK_BOTTOM*(vu32 *)STM32_FLASH_BASE_ADDRESS1;//取APP的SP初值 STACK_TOP1STACK_BOTTOM; } //函数功能:在中断函数…

cookies、localStorage 、sessionStorage 的区别

共同点&#xff1a;三者都是浏览器的本地存储。 区别&#xff1a; 存储位置&#xff1a;cookie是由服务器端写入的&#xff0c;而SessionStorage、LocalStorage都是由前端写入的&#xff1b; 存储大小&#xff1a;cookie的存储空间比较小&#xff0c;大概4KB,而SessionStorag…

webpack编译微信小程序

微信小程序开发目前主要还是依赖小程序原生开发者工具&#xff0c;但开发者工具目前还不支持常用的less、sass样式编译&#xff0c;以及环境变量配置等功能。使用webpack就可以弥补这些问题。 思路 webpack启动后&#xff0c;通过webpack-shell-plugin-next包执行启动后的一些…

沉浸式翻译

chrome沉浸式翻译插件 网页双语翻译&#xff0c;完全免费使用&#xff0c;支持Deepl/Google/Bing/腾讯/有道等。 一款免费、用户友好、简洁、革命性、广受好评的人工智能双语网络翻译扩展程序&#xff0c;可帮助您有效地弥合信息差距&#xff0c;也可在移动设备上使用&#xff…

【ArcGIS Pro二次开发】(44):属性结构描述表【Excel】转空库(批量)

随着县级国土空间总体规划数据库规范的下发&#xff0c;建立标准空库是一项马上就要着手的工作。国空的数据库体量很大&#xff0c;单是要素类就有100多个&#xff0c;不是以前村规数据库能比的&#xff0c;手动建库是不可能的&#xff0c;工具自动建库就是一个很合理的选择。 …

短视频seo矩阵系统源码开发思路

短视频SEO矩阵系统源码开发&#xff0c;需要遵循一下步骤&#xff1a; 1. 确定需求和功能&#xff1a;明确系统的主要目标和需要实现的功能&#xff0c;包括关键词研究、短视频制作、外链建设、数据分析、账号设置优化等方面。 2. 设计系统架构&#xff1a;根据需求和功能确定…