<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>comeRound</title>
 <link href="https://comeround.cn/atom.xml" rel="self"/>
 <link href="https://comeround.cn/"/>
 <updated>2026-07-04T20:36:22+08:00</updated>
 <id>https://comeround.cn</id>
 <author>
   <name>comeRound</name>
   <email>linzening@qq.com</email>
 </author>

 
 <entry>
   <title>国产操作系统操作指南</title>
   <link href="https://comeround.cn/article/deepin-note.html"/>
   <updated>2026-06-18T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/deepin-note</id>
   <content type="html">&lt;h6 id=&quot;说明&quot;&gt;说明&lt;/h6&gt;

&lt;p&gt;本文档所说的国产系统主要是deepin系统、UOS系统&lt;/p&gt;

&lt;h2 id=&quot;一基本知识&quot;&gt;（一）基本知识&lt;/h2&gt;

&lt;h3 id=&quot;处理器架构&quot;&gt;处理器架构&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;X86授权路线（海光、兆芯）：复杂指令集CISC&lt;/li&gt;
  &lt;li&gt;ARM授权路线（飞腾、鲲鹏）：精简指令集RISC&lt;/li&gt;
  &lt;li&gt;全自研自主指令集（龙芯LoongArch、申威SW64）：无境外架构授权&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;处理器架构详细表&quot;&gt;处理器架构详细表&lt;/h5&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;处理器架构&lt;/th&gt;
      &lt;th&gt;厂商&lt;/th&gt;
      &lt;th&gt;常用的处理器型号&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;X86、AMD64&lt;/td&gt;
      &lt;td&gt;Intel、AMD、海光、兆芯&lt;/td&gt;
      &lt;td&gt;I5-9400F、C86-3G、KX-8000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;ARM&lt;/td&gt;
      &lt;td&gt;高通骁龙、联发科天玑、华为麒麟&lt;/td&gt;
      &lt;td&gt;天玑9500、骁龙8gen5、麒麟9020&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;LoongArch&lt;/td&gt;
      &lt;td&gt;龙芯&lt;/td&gt;
      &lt;td&gt;3C6000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;MIPS&lt;/td&gt;
      &lt;td&gt;-&lt;/td&gt;
      &lt;td&gt;暂无&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;RISC-V&lt;/td&gt;
      &lt;td&gt;-&lt;/td&gt;
      &lt;td&gt;暂无&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;SW-64（纯自研）&lt;/td&gt;
      &lt;td&gt;申威&lt;/td&gt;
      &lt;td&gt;民用市场基本没存在感&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h5 id=&quot;国产处理器&quot;&gt;国产处理器&lt;/h5&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;厂商&lt;/th&gt;
      &lt;th&gt;架构路线&lt;/th&gt;
      &lt;th&gt;自主程度&lt;/th&gt;
      &lt;th&gt;最强场景&lt;/th&gt;
      &lt;th&gt;2026年现状&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;海光&lt;/td&gt;
      &lt;td&gt;x86（AMD Zen）&lt;/td&gt;
      &lt;td&gt;中&lt;/td&gt;
      &lt;td&gt;金融/电信服务器&lt;/td&gt;
      &lt;td&gt;海光四号量产，五号在路上&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;鲲鹏&lt;/td&gt;
      &lt;td&gt;ARMv8（华为自研核）&lt;/td&gt;
      &lt;td&gt;较高&lt;/td&gt;
      &lt;td&gt;政务云/运营商&lt;/td&gt;
      &lt;td&gt;950发布，全栈生态最完整&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;龙芯&lt;/td&gt;
      &lt;td&gt;LoongArch（纯自研）&lt;/td&gt;
      &lt;td&gt;最高&lt;/td&gt;
      &lt;td&gt;党政/军工/涉密&lt;/td&gt;
      &lt;td&gt;3C6000对标至强，性能够用&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;飞腾&lt;/td&gt;
      &lt;td&gt;ARMv8（自研核）&lt;/td&gt;
      &lt;td&gt;较高&lt;/td&gt;
      &lt;td&gt;党政办公/移动端&lt;/td&gt;
      &lt;td&gt;D3000成国产笔记本主力&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;兆芯&lt;/td&gt;
      &lt;td&gt;x86（威盛授权）&lt;/td&gt;
      &lt;td&gt;中低&lt;/td&gt;
      &lt;td&gt;教育/商业办公&lt;/td&gt;
      &lt;td&gt;KX-8000冲刺4GHz主频&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;申威&lt;/td&gt;
      &lt;td&gt;SW-64（纯自研）&lt;/td&gt;
      &lt;td&gt;最高&lt;/td&gt;
      &lt;td&gt;超算/军工特种&lt;/td&gt;
      &lt;td&gt;民用市场基本没存在感&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h5 id=&quot;linux发行版&quot;&gt;Linux发行版&lt;/h5&gt;

&lt;p&gt;国内好用的Linux主要分两大类：服务器/云原生（欧拉、龙蜥）、桌面/办公（统信UOS、Deepin、银河麒麟、优麒麟）。&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;系统名称&lt;/th&gt;
      &lt;th&gt;核心定位&lt;/th&gt;
      &lt;th&gt;适配芯片&lt;/th&gt;
      &lt;th&gt;桌面环境&lt;/th&gt;
      &lt;th&gt;包管理器&lt;/th&gt;
      &lt;th&gt;主打亮点&lt;/th&gt;
      &lt;th&gt;适合人群/场景&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;华为欧拉 openEuler&lt;/td&gt;
      &lt;td&gt;服务器/云计算/工业&lt;/td&gt;
      &lt;td&gt;X86、鲲鹏ARM&lt;/td&gt;
      &lt;td&gt;无侧重桌面&lt;/td&gt;
      &lt;td&gt;dnf/yum&lt;/td&gt;
      &lt;td&gt;鲲鹏深度优化、云原生强、容器虚拟化成熟&lt;/td&gt;
      &lt;td&gt;运维、企业服务器、机房、边缘计算&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;阿里云龙蜥 AnolisOS&lt;/td&gt;
      &lt;td&gt;云服务器、CentOS替代&lt;/td&gt;
      &lt;td&gt;X86、ARM&lt;/td&gt;
      &lt;td&gt;可选极简桌面&lt;/td&gt;
      &lt;td&gt;dnf/yum&lt;/td&gt;
      &lt;td&gt;100%兼容CentOS、云上性能拉满、迁移零成本&lt;/td&gt;
      &lt;td&gt;互联网公司、云上运维、大数据集群&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;深度Deepin&lt;/td&gt;
      &lt;td&gt;个人桌面、日常办公娱乐&lt;/td&gt;
      &lt;td&gt;X86为主&lt;/td&gt;
      &lt;td&gt;自研DDE高颜值&lt;/td&gt;
      &lt;td&gt;apt&lt;/td&gt;
      &lt;td&gt;界面酷似Windows、软件开箱即用、小白友好&lt;/td&gt;
      &lt;td&gt;个人用户、家用、办公追剧、新手&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;统信 UOS&lt;/td&gt;
      &lt;td&gt;政企办公+个人全能&lt;/td&gt;
      &lt;td&gt;X86、飞腾、龙芯、鲲鹏&lt;/td&gt;
      &lt;td&gt;DDE&lt;/td&gt;
      &lt;td&gt;apt&lt;/td&gt;
      &lt;td&gt;版本齐全、国产软件适配最全、国产化首选&lt;/td&gt;
      &lt;td&gt;事业单位、国企办公、家庭日常&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;银河麒麟 Kylin&lt;/td&gt;
      &lt;td&gt;党政军工、高安全涉密&lt;/td&gt;
      &lt;td&gt;全国产CPU+X86&lt;/td&gt;
      &lt;td&gt;定制桌面&lt;/td&gt;
      &lt;td&gt;apt/dnf&lt;/td&gt;
      &lt;td&gt;安全等级顶级、稳定性极强、政企标配&lt;/td&gt;
      &lt;td&gt;政府、军工、金融、涉密单位&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;优麒麟 Ubuntu Kylin&lt;/td&gt;
      &lt;td&gt;轻量桌面、老旧电脑&lt;/td&gt;
      &lt;td&gt;X86、ARM&lt;/td&gt;
      &lt;td&gt;Mate&lt;/td&gt;
      &lt;td&gt;apt&lt;/td&gt;
      &lt;td&gt;基于Ubuntu、资源多、占用低、流畅省配置&lt;/td&gt;
      &lt;td&gt;学生、老旧笔记本、开发测试&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;ul&gt;
  &lt;li&gt;银河麒麟分桌面版、服务器版两套体系，银河麒麟桌面版（V10 桌面）：基于 Ubuntu，使用apt；银河麒麟服务器版（V10 SP1+）：基于 RHEL，使用dnf/yum&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;除此之外，国际上还有一些Linux发行版：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ubuntu&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Arch Linux&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Linux Mint&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Linux Lite&lt;/code&gt;都值得一试。&lt;/p&gt;

&lt;h2 id=&quot;二基本操作&quot;&gt;（二）基本操作&lt;/h2&gt;

&lt;h3 id=&quot;1系统安装&quot;&gt;1、系统安装&lt;/h3&gt;

&lt;p&gt;使用ventoy创建启动盘&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2026/ventoy.png&quot; alt=&quot;ventoy&quot; width=&quot;300px&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;双系统&lt;/strong&gt; Windows使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NTFS&lt;/code&gt;格式的磁盘、Linux使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;EXT4&lt;/code&gt;格式的磁盘&lt;/p&gt;

&lt;h3 id=&quot;2基本设置初始配置&quot;&gt;2、基本设置/初始配置&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;免密登录&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;设置→用户→使用无密码登录&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;设置禁止更新&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;设置启动延迟或启动LOGO&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;设置屏幕显示大小&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;3常用快捷键&quot;&gt;3、常用快捷键&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Super&lt;/code&gt;键：打开启动器&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Super+D&lt;/code&gt;：显示桌面&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Super+Tab&lt;/code&gt;：应用切换&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl+Alt+T&lt;/code&gt;：打开终端&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Super+Shift+S&lt;/code&gt;：截图&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;4基本命令&quot;&gt;4、基本命令&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;更新系统：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;apt update &amp;amp;&amp;amp; apt upgrade -y&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;三介绍&quot;&gt;（三）介绍&lt;/h2&gt;

&lt;p&gt;deepin（原名Linux Deepin）是由武汉深之度科技有限公司开发的Linux发行版，现由统信软件技术有限公司维护。&lt;/p&gt;

&lt;h2 id=&quot;四其他扩展高级功能&quot;&gt;（四）其他扩展高级功能&lt;/h2&gt;

&lt;h3 id=&quot;1系统配置&quot;&gt;1、系统配置&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;主题&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 安装主题&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;deepin-theme-&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 切换主题&lt;/span&gt;
gsettings &lt;span class=&quot;nb&quot;&gt;set &lt;/span&gt;com.deepin.desktop.interface icon-theme &lt;span class=&quot;s2&quot;&gt;&quot;deepin&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;字体配置&lt;/strong&gt;：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;系统字体：文泉驿微米黑&lt;/li&gt;
  &lt;li&gt;等宽字体：DejaVu Sans Mono&lt;/li&gt;
  &lt;li&gt;支持字体平滑和抗锯齿&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;2开发环境搭建&quot;&gt;2、开发环境搭建&lt;/h3&gt;

&lt;h4 id=&quot;基础开发工具&quot;&gt;基础开发工具&lt;/h4&gt;

&lt;h5 id=&quot;编译工具&quot;&gt;编译工具&lt;/h5&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 安装编译工具&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;build-essential gcc g++ make cmake
&lt;span class=&quot;c&quot;&gt;# 安装版本控制&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;git gitk git-gui
&lt;span class=&quot;c&quot;&gt;# 安装调试工具&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;gdb valgrind strace
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;nginx安装&quot;&gt;Nginx安装&lt;/h5&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;nginx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;编程语言环境&quot;&gt;编程语言环境&lt;/h4&gt;

&lt;h5 id=&quot;python开发&quot;&gt;Python开发&lt;/h5&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 安装Python3&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;python3 python3-pip python3-venv
&lt;span class=&quot;c&quot;&gt;# 安装常用库&lt;/span&gt;
pip3 &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;numpy pandas matplotlib jupyter
&lt;span class=&quot;c&quot;&gt;# 安装IDE&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;pycharm-community
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;nodejs开发&quot;&gt;Node.js开发&lt;/h5&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 使用nvm安装Node.js&lt;/span&gt;
curl &lt;span class=&quot;nt&quot;&gt;-o-&lt;/span&gt; https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;node
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;数据库环境&quot;&gt;数据库环境&lt;/h4&gt;

&lt;h5 id=&quot;mysql&quot;&gt;MySQL&lt;/h5&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;mysql-server mysql-client
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;mysql_secure_installation
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;postgresql&quot;&gt;PostgreSQL&lt;/h5&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;postgresql postgresql-contrib
&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; postgres psql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;redis&quot;&gt;Redis&lt;/h5&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;redis-server
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl &lt;span class=&quot;nb&quot;&gt;enable &lt;/span&gt;redis-server
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;3系统管理与维护&quot;&gt;3、系统管理与维护&lt;/h3&gt;

&lt;h4 id=&quot;软件包管理&quot;&gt;软件包管理&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;APT常用命令&lt;/strong&gt;：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 更新软件包列表&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt update

&lt;span class=&quot;c&quot;&gt;# 升级系统&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt upgrade

&lt;span class=&quot;c&quot;&gt;# 安装软件&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;package-name

&lt;span class=&quot;c&quot;&gt;# 卸载软件&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt remove package-name
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt purge package-name  &lt;span class=&quot;c&quot;&gt;# 彻底删除配置文件&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 搜索软件&lt;/span&gt;
apt search keyword

&lt;span class=&quot;c&quot;&gt;# 查看软件信息&lt;/span&gt;
apt show package-name
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;服务管理&quot;&gt;服务管理&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;systemd操作&lt;/strong&gt;：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 查看服务状态&lt;/span&gt;
systemctl status service-name

&lt;span class=&quot;c&quot;&gt;# 启动/停止服务&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl start service-name
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl stop service-name

&lt;span class=&quot;c&quot;&gt;# 启用/禁用开机启动&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl &lt;span class=&quot;nb&quot;&gt;enable &lt;/span&gt;service-name
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl disable service-name

&lt;span class=&quot;c&quot;&gt;# 重新加载配置&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl reload service-name
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;systemctl daemon-reload
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;日志管理&quot;&gt;日志管理&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;日志位置&lt;/strong&gt;：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;系统日志：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/log/syslog&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;认证日志：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/log/auth.log&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;内核日志：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/log/kern.log&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;应用日志：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/log/&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;日志查看工具&lt;/strong&gt;：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 实时查看日志&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;tail&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; /var/log/syslog

&lt;span class=&quot;c&quot;&gt;# 使用journalctl&lt;/span&gt;
journalctl &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; service-name
journalctl &lt;span class=&quot;nt&quot;&gt;--since&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;2024-01-01&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--until&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;2024-01-02&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;网络诊断工具&quot;&gt;网络诊断工具&lt;/h4&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 连通性测试&lt;/span&gt;
ping google.com

&lt;span class=&quot;c&quot;&gt;# 路由追踪&lt;/span&gt;
traceroute google.com

&lt;span class=&quot;c&quot;&gt;# 端口扫描&lt;/span&gt;
nmap localhost

&lt;span class=&quot;c&quot;&gt;# 网络性能测试&lt;/span&gt;
iperf3 &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; server-ip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;性能监控工具&quot;&gt;性能监控工具&lt;/h4&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 安装监控工具&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;htop iotop iftop nmon

&lt;span class=&quot;c&quot;&gt;# 实时监控&lt;/span&gt;
htop
iotop
iftop
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;故障排查&quot;&gt;故障排查&lt;/h4&gt;

&lt;h4 id=&quot;系统信息&quot;&gt;系统信息&lt;/h4&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 查看系统版本&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /etc/os-release
&lt;span class=&quot;nb&quot;&gt;uname&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 查看硬件信息&lt;/span&gt;
lscpu
lsblk
lspci
lsusb

&lt;span class=&quot;c&quot;&gt;# 查看内存使用&lt;/span&gt;
free &lt;span class=&quot;nt&quot;&gt;-h&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;文件操作&quot;&gt;文件操作&lt;/h4&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 查找文件&lt;/span&gt;
find /path &lt;span class=&quot;nt&quot;&gt;-name&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;filename&quot;&lt;/span&gt;
locate filename

&lt;span class=&quot;c&quot;&gt;# 压缩解压&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-czvf&lt;/span&gt; archive.tar.gz directory/
&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-xzvf&lt;/span&gt; archive.tar.gz

&lt;span class=&quot;c&quot;&gt;# 文本处理&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;pattern&quot;&lt;/span&gt; file
&lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;s/old/new/g&apos;&lt;/span&gt; file
&lt;span class=&quot;nb&quot;&gt;awk&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;{print $1}&apos;&lt;/span&gt; file
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;进程管理&quot;&gt;进程管理&lt;/h4&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 查看进程&lt;/span&gt;
ps aux
top
htop

&lt;span class=&quot;c&quot;&gt;# 进程控制&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;kill &lt;/span&gt;PID
&lt;span class=&quot;nb&quot;&gt;kill&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-9&lt;/span&gt; PID
pkill process-name
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;网络命令&quot;&gt;网络命令&lt;/h4&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 网络配置&lt;/span&gt;
ip addr
ip route
ss &lt;span class=&quot;nt&quot;&gt;-tuln&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 网络测试&lt;/span&gt;
ping host
curl url
wget url
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h6 id=&quot;总结&quot;&gt;总结&lt;/h6&gt;

&lt;p&gt;deepin作为一款优秀的国产Linux发行版，具有以下优势：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;用户体验优秀&lt;/strong&gt;：DDE桌面环境美观易用&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;软件生态完善&lt;/strong&gt;：兼容大量Linux软件&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;安全性高&lt;/strong&gt;：基于Debian稳定版本&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;适合开发&lt;/strong&gt;：支持多种开发环境&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;本土化好&lt;/strong&gt;：中文支持完善&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;对于专业技术人员来说，deepin提供了稳定可靠的开发和工作环境，同时具备良好的扩展性和定制性，是值得推荐的Linux发行版之一。&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>AI能做哪些事情？</title>
   <link href="https://comeround.cn/article/aigc-can-do.html"/>
   <updated>2026-04-14T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/aigc-can-do</id>
   <content type="html">&lt;h2 id=&quot;1知识问答&quot;&gt;（1）知识问答&lt;/h2&gt;

&lt;h5 id=&quot;1给我整理初中数学的公式&quot;&gt;「1」给我整理初中数学的公式&lt;/h5&gt;

&lt;h5 id=&quot;210米长的木棍能通过152米的门吗&quot;&gt;「2」10米长的木棍能通过1.5*2米的门吗&lt;/h5&gt;

&lt;p&gt;AI回复：根据几何学原理，10米长的木棍无法通过宽1.5米、高2米的门。无论是否倾斜或调整角度，10米长的木棍均无法通过宽1.5米、高2米的门。若必须通过，建议考虑拆解木棍、选择弯曲（若材质允许）或寻找其他路径。&lt;/p&gt;

&lt;h5 id=&quot;3我想去洗车洗车店距离我家50米我应该开车过去还是走过去&quot;&gt;「3」我想去洗车，洗车店距离我家50米，我应该开车过去还是走过去？&lt;/h5&gt;

&lt;h5 id=&quot;4五个国家领导人一一握手总共需要握手多少次&quot;&gt;「4」五个国家领导人一一握手，总共需要握手多少次？&lt;/h5&gt;

&lt;h5 id=&quot;5投掷两个骰子都是大的概率为多少&quot;&gt;「5」投掷两个骰子，都是大的概率为多少？&lt;/h5&gt;

&lt;h2 id=&quot;2用于教学&quot;&gt;（2）用于教学&lt;/h2&gt;

&lt;h3 id=&quot;1国家智慧中小学智能助手&quot;&gt;「1」国家智慧中小学智能助手&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;飞象老师：制作课件、AI命题、AI组卷、制作奖状&lt;/li&gt;
  &lt;li&gt;九章数学举一反三：“上传一道题，输出三个类似题目”&lt;/li&gt;
  &lt;li&gt;九章大模型：会话&lt;/li&gt;
  &lt;li&gt;希沃：教学设计&lt;/li&gt;
  &lt;li&gt;企鹅教师助手：制作课件&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;2教案生成&quot;&gt;「2」教案生成&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;提示词的用法&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;生成一篇关于初中数学《一元二次方程》的教案&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;3改卷分析&quot;&gt;「3」改卷分析&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;需要把试卷统一扫描成图片&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;4工作总结&quot;&gt;「4」工作总结&lt;/h3&gt;

&lt;h2 id=&quot;3图片视频生成&quot;&gt;（3）图片视频生成&lt;/h2&gt;

&lt;h3 id=&quot;1图片生成&quot;&gt;「1」图片生成&lt;/h3&gt;

&lt;p&gt;生成“两岸猿声啼不住”的场景图片&lt;/p&gt;

&lt;h3 id=&quot;2数字人&quot;&gt;「2」数字人&lt;/h3&gt;

&lt;p&gt;即梦AI：生成陶渊明在桃花源记时的场景&lt;/p&gt;

&lt;h2 id=&quot;4html工具人&quot;&gt;（4）HTML工具人&lt;/h2&gt;

&lt;h5 id=&quot;1随机点名器&quot;&gt;「1」随机点名器&lt;/h5&gt;

&lt;p&gt;请帮我用HTML+CSS+JavaScript做一个课堂智能随机点名器，具体要求： 1. 页面上方有一个输入框，老师可以粘贴全班学生名单（用逗号或换行分隔） 2. 输入框下方有一个”开始点名”按钮，点击后名字快速滚动显示（动画效果） 3. 再点”停止”按钮，随机定格在一个学生名字上，名字放大显示并高亮 4. 页面右侧显示”已点到”和”未点到”两个列表，点名后自动归类 5. 每个学生名字旁边显示”被点到次数” 6. 底部有”重置本节课”按钮，点后清空已点名记录但不删名单 7. 名单用localStorage保存，下次打开页面自动恢复 8. 整体风格：卡通可爱风，主色调用绿色系，适合投屏到教室大屏幕&lt;/p&gt;

&lt;h5 id=&quot;2课堂倒计时器&quot;&gt;「2」课堂倒计时器&lt;/h5&gt;

&lt;p&gt;请帮我用HTML+CSS+JavaScript做一个课堂倒计时器，具体要求： 1. 页面中央大字显示倒计时数字（字号超大，教室最后一排能看清） 2. 上方有一排快捷按钮：30秒、1分钟、3分钟、5分钟、10分钟 3. 还有一个自定义输入框，可以输入任意时间（如”2分30秒”） 4. 点击快捷按钮或输入时间后，按”开始”启动倒计时 5. 最后30秒，页面背景变成红色并闪烁提醒 6. 归零时播放一声提示音效（用Web Audio API简单实现，不需要音频文件） 7. 支持”暂停”和”继续”按钮 8. 底部有”重置”按钮，回到初始状态 9. 整体风格：简洁清爽，主色调用绿色系，适合投屏到教室大屏幕&lt;/p&gt;

&lt;h5 id=&quot;3翻页笔答题&quot;&gt;「3」翻页笔答题&lt;/h5&gt;

&lt;p&gt;&lt;a href=&quot;http://hello.fe80.cn/pages/choice_questions.html?course_id=1&quot;&gt;七下生物选择题&lt;/a&gt;&lt;/p&gt;

&lt;h5 id=&quot;4课堂游戏制作&quot;&gt;「4」课堂游戏制作&lt;/h5&gt;

&lt;p&gt;象棋、五子棋、俄罗斯方块等等&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://file.fe80.cn/labs/2025/%E4%BA%94%E5%AD%90%E6%A3%8B.html&quot;&gt;五子棋&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://file.fe80.cn/labs/2025/%E7%82%AB%E5%BD%A9%E4%BF%84%E7%BD%97%E6%96%AF%E6%96%B9%E5%9D%97.html&quot;&gt;俄罗斯方块&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://file.fe80.cn/labs/2025/%E8%B4%AA%E5%90%83%E8%9B%87%EF%BC%88%E4%B8%833%E7%8F%AD%EF%BC%89.html&quot;&gt;贪吃蛇&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;5英语单词练习小工具&quot;&gt;「5」英语单词练习小工具&lt;/h5&gt;

&lt;p&gt;&lt;a href=&quot;http://file.fe80.cn/pages/flashcards/index.html&quot;&gt;初中英语单词&lt;/a&gt;&lt;/p&gt;

&lt;h5 id=&quot;6语文古诗词填空&quot;&gt;「6」语文古诗词填空&lt;/h5&gt;

&lt;h5 id=&quot;7地理省级拼图&quot;&gt;「7」地理省级拼图&lt;/h5&gt;

&lt;h2 id=&quot;5办公助手&quot;&gt;（5）办公助手&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;WPS灵犀&lt;/strong&gt;：计算各科平均分&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2026/wps-avg.jpg&quot; alt=&quot;&quot; width=&quot;300px&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WPS灵犀&lt;/strong&gt;：把1个表按照班级拆分成多个表&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2026/wps-split.jpg&quot; alt=&quot;&quot; width=&quot;300px&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;6代码开发&quot;&gt;（6）代码开发&lt;/h2&gt;

&lt;h3 id=&quot;数据对比&quot;&gt;数据对比&lt;/h3&gt;

&lt;p&gt;输入A组数据和B组数据，比较其中的数据差异并输出结果 &lt;a href=&quot;http://hello.fe80.cn/pages/html/translator.html&quot;&gt;数据对比&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;成绩统计&quot;&gt;成绩统计&lt;/h3&gt;

&lt;h5 id=&quot;1编写javascript程序实现数据统计功能&quot;&gt;「1」编写JavaScript程序，实现数据统计功能&lt;/h5&gt;

&lt;h5 id=&quot;2在ima中上传成绩并生成成绩统计&quot;&gt;「2」在IMA中上传成绩，并生成成绩统计&lt;/h5&gt;

&lt;h3 id=&quot;成绩分析&quot;&gt;成绩分析&lt;/h3&gt;

&lt;p&gt;把成绩输入，生成成绩分析PDF&lt;/p&gt;

&lt;h3 id=&quot;数据可视化大屏制作&quot;&gt;数据可视化大屏制作&lt;/h3&gt;

&lt;h2 id=&quot;7流程图思维导图生成&quot;&gt;（7）流程图思维导图生成&lt;/h2&gt;

&lt;p&gt;WPS导入markdown&lt;/p&gt;

&lt;h2 id=&quot;8ai工具及应用&quot;&gt;（8）AI工具及应用&lt;/h2&gt;

&lt;h5 id=&quot;ima知识库&quot;&gt;IMA知识库&lt;/h5&gt;

&lt;p&gt;把已有的校本数据导入IMA，并利用IMA进行问答&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2026/ima-question.jpg&quot; alt=&quot;&quot; width=&quot;300px&quot; /&gt;&lt;/p&gt;

&lt;h6 id=&quot;提供的下载链接&quot;&gt;提供的下载链接&lt;/h6&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.codebuddy.cn/work/&quot;&gt;下载安装WorkBuddy&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://ima.qq.com/&quot;&gt;下载安装IMA&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Python代码示例</title>
   <link href="https://comeround.cn/article/python-code.html"/>
   <updated>2025-12-18T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/python-code</id>
   <content type="html">&lt;h2 id=&quot;分支结构if语句&quot;&gt;分支结构IF语句&lt;/h2&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;num&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;num&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;# % 是取余运算，如果余数为0，说明能被3整除
&lt;/span&gt;    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;num&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; 是3的倍数&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;num&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; 不是3的倍数&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;获取一个数字的个位十位百位&quot;&gt;获取一个数字的个位、十位、百位&lt;/h2&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;795&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;x1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;                   &lt;span class=&quot;c1&quot;&gt;# 除以10，取余数
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;//&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;        &lt;span class=&quot;c1&quot;&gt;# 除以100，取余数，再整除10
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;//&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# 除以1000，取余数，再整除100
&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;个位是&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x1&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;十位是&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x2&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;百位是&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x3&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;循环示例&quot;&gt;循环示例&lt;/h2&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;用 while 循环倒数 5 到 1：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;          &lt;span class=&quot;c1&quot;&gt;# 每次减1，否则会无限循环！
&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;发射！🚀&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;100以内3的倍数&quot;&gt;100以内3的倍数&lt;/h2&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;100以内3的倍数有：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;101&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;        &lt;span class=&quot;c1&quot;&gt;# 1 到 100
&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;# end=&quot; &quot; 让数字在同一行显示
&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# 换行
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;100以内包含数字7的数字&quot;&gt;100以内包含数字7的数字&lt;/h2&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;100以内包含数字7的数有：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;101&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# 判断十位或个位为7
&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;//&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;  
        &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;鸡兔同笼解答&quot;&gt;鸡兔同笼解答&lt;/h2&gt;

&lt;p&gt;笼子里有若干只鸡和兔子，从上面数，共有 10 个头；从下面数，共有 28 只脚。已知鸡有 2 条腿，兔子有 4 条腿。问：笼中有几只鸡？几只兔子？&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 鸡兔同笼问题：总头数 = 10，总脚数 = 28
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;total_heads&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;total_feet&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;28&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 用 for 循环尝试所有可能的鸡的数量（0 到 10）
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;chickens&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;total_heads&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;# range(0, 11) 表示 0~10
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;rabbits&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;total_heads&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;chickens&lt;/span&gt;            &lt;span class=&quot;c1&quot;&gt;# 兔子数量 = 总头数 - 鸡数量
&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# 计算当前组合的总脚数
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;feet&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;chickens&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rabbits&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# 如果脚数刚好等于 28，就输出答案
&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;feet&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;total_feet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;找到了！鸡有 &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;chickens&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; 只，兔子有 &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rabbits&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; 只。&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# 找到答案后就停止循环
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# 如果循环结束都没找到（比如题目数据错了），就提示无解
&lt;/span&gt;    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;没有符合条件的解！&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;数学题&quot;&gt;数学题&lt;/h2&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# 初始化n为1
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# 初始化累加和s为0
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# 当s小于等于100时执行循环
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# 先执行s = s + n
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# 输出此时的n
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>JavaScript进阶学习</title>
   <link href="https://comeround.cn/article/js-advanced-learning.html"/>
   <updated>2025-04-16T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/js-advanced-learning</id>
   <content type="html">&lt;p&gt;以下是针对 JavaScript 近年新特性的系统性学习文档，结合 ES6+ 核心特性与最新实践技巧整理而成：&lt;/p&gt;

&lt;h2 id=&quot;一基础语法&quot;&gt;一、基础语法&lt;/h2&gt;

&lt;h3 id=&quot;11-lambda-表达式箭头函数&quot;&gt;1.1 Lambda 表达式（箭头函数）&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// 传统函数&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 箭头函数简写&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;​特性​：&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;​词法作用域​：自动绑定外层 this，无需 bind()（如 React 类组件中处理事件）&lt;/li&gt;
  &lt;li&gt;​隐式返回​：单行表达式可省略 {} 和 return&lt;/li&gt;
  &lt;li&gt;​参数简写​：单参数可省略括号 (x) =&amp;gt; x&lt;em&gt;2 → x =&amp;gt; x&lt;/em&gt;2&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lambda表达式典型场景&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// 数组操作（配合 map/filter）&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;scores&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;90&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;85&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;77&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;passed&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;scores&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;score&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;score&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// [90, 85]&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 异步回调&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;/api/data&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;12-string的扩展方法&quot;&gt;1.2 String的扩展方法&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;张三&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;strall&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;`姓名为：&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;strsum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;`12 + 32 为：&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;张三&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;sex&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;男&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;`姓名：&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;，年龄&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;，性别：&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;13-string的其他方法&quot;&gt;1.3 String的其他方法&lt;/h3&gt;

&lt;h4 id=&quot;strstartswith-和-strendswith&quot;&gt;str.startsWith() 和 str.endsWith()&lt;/h4&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;张三&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;startsWith&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;张&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// true&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;endsWith&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;三&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;strrepeat&quot;&gt;str.repeat()&lt;/h4&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Hello&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;repeat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// &apos;HelloHelloHello&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;14-数组的基本方法&quot;&gt;1.4 数组的基本方法&lt;/h3&gt;

&lt;p&gt;​修改原数组的方法​：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;push&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pop&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unshift&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shift&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;splice&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sort&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reverse&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;​返回新数组的方法​：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;concat&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;slice&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;map&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;filter&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;​ES5新增的迭代方法​：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;forEach&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;map&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;filter&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reduce&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reduceRight&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;some&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;every&lt;/code&gt;。&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;// arr → [1, 2, 3]&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;pop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;        &lt;span class=&quot;c1&quot;&gt;// arr → [1, 2]&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;unshift&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;// arr → [0, 1, 2]&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;shift&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;// arr → [1, 2]&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;concat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;// b → [1, 2, 3, 4, 5]&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;        &lt;span class=&quot;c1&quot;&gt;// str → &quot;1-2&quot;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;40&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sub&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;slice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;// sub → [20, 30]&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;splice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;99&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;             &lt;span class=&quot;c1&quot;&gt;// c → [10, 99, 40]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;arr.slice()&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;arr.concat()&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;arr.indexOf()&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;arr.chunk()&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;arr.reverse()&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;15-map的使用方法&quot;&gt;1.5 Map的使用方法&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;分数&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 链式调用&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 18&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;has&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;gender&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// false&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 遍历键值对&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// a 1, b 2, c 3&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 使用 for...of&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 同上&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 获取迭代器&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;keys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()]);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;]&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;values&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()]);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// [1, 2, 3]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;二数组高阶方法&quot;&gt;二、数组高阶方法&lt;/h2&gt;

&lt;h3 id=&quot;21-数组合并与拆解&quot;&gt;2.1 数组合并与拆解&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;22&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;33&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arr1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arr2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;arr1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;arr2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// [1, 2, 3, 3, 4, 5]&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;arr3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;rest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;arr3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 1&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;rest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// [2, 3, 4, 5]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;arg1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;arg1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 1, [2, 3, 4, 5]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;21-arraymap&quot;&gt;2.1 Array.map()&lt;/h3&gt;

&lt;p&gt;​用途​：映射数组元素生成新数组&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Alice&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Bob&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}];&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;names&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// [&apos;Alice&apos;, &apos;Bob&apos;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;22-arrayfilter&quot;&gt;2.2 Array.filter()&lt;/h3&gt;

&lt;p&gt;​用途​：条件筛选数组&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;numbers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;even&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// [2, 4]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;相当于数据库的where条件&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Alice&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Blind&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;27&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Bob&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Pongo&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}];&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;even&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;age&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;字符串匹配&quot;&gt;字符串匹配&lt;/h5&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;originalArray&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;姓名&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;语文&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;班级&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;考号&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;总分&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;数学&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;物理&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;道法&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;道德&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;科学&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 使用正则表达式匹配 &quot;语、数、英、道&quot;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;originalArray&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;语数英道理历生化&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 把学科字段匹配出来&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;23-arrayflatmapes2019&quot;&gt;2.3 Array.flatMap()（ES2019）&lt;/h3&gt;

&lt;p&gt;​用途​：先映射后扁平化&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;phrases&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Hello world&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Goodbye moon&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;words&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;phrases&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;flatMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;phrase&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;phrase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt; 
&lt;span class=&quot;c1&quot;&gt;// [&quot;Hello&quot;, &quot;world&quot;, &quot;Goodbye&quot;, &quot;moon&quot;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;24-arrayfind--arrayfindindex&quot;&gt;2.4 Array.find() / Array.findIndex()&lt;/h3&gt;

&lt;p&gt;用于找出第一个符合条件的数组成员，如果没有找到返回undefined&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Alice&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Blind&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Bob&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}];&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;age&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// {name: &apos;Alice&apos;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;用于找出第一个符合条件的数组成员的位置，如果没有找到返回-1&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Alice&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Blind&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;27&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Bob&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}];;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;userIndex&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;findIndex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;age&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;28&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;25-arrayincludes&quot;&gt;2.5 Array.includes()&lt;/h3&gt;

&lt;p&gt;表示某个数组是否包含给定的值，返回布尔值。&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;includes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// true&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;includes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;也可以处理字符串&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;includes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;el&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;25-arrayreduce&quot;&gt;2.5 Array.reduce()&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;reduce&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;prev&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cur&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;prev&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cur&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;prev&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cur&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;arr:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;sum:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//sum=15&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// 数组对象&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// item是arr遍历出来的值&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;reduce&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//返回给下一个your的值&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//给sum的初始值&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;26-arraysome-&quot;&gt;2.6 Array.some() /&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Array.some() 极简使用笔记&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 核心功能​​：判断数组中 ​​是否至少有一个元素​​ 满足指定条件，一旦找到符合条件的元素，立即返回 true（停止遍历），若全部不满足，返回 false&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 示例数组&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;numbers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 检查是否存在偶数&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;hasEven&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;some&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hasEven&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// false&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 检查是否存在大于5的数&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;hasBig&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;some&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hasBig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// true（7和9满足）&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;users2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Alice&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;active&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Bob&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;active&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;hasActiveUser&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;users2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;some&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;active&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hasActiveUser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// true（Alice是active）&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;26-arrayevery&quot;&gt;2.6 Array.every()&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Array.every()&lt;/code&gt;方法用于检测数组中的所有元素是否都满足指定条件&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Alice&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;25&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Bob&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Charlie&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;18&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 检查所有用户是否都是成年人（age &amp;gt;= 18）&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;allAdults&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;every&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;age&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;allAdults&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;27-arraysortes2019&quot;&gt;2.7 Array.sort()（ES2019）&lt;/h3&gt;

&lt;h5 id=&quot;对象数组排序&quot;&gt;对象数组排序&lt;/h5&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sortedStudents&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;students&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sort&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; 
    &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;grade&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;grade&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; 
    &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;- &lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;|| 
    &lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;number&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;数字数组排序&quot;&gt;数字数组排序&lt;/h5&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;nums&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;19&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;67&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sort&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;28-arrayfromes2019&quot;&gt;2.8 Array.from()（ES2019）&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Array.from()&lt;/code&gt;方法用于将类数组对象（array-like）或可迭代对象（iterable）转换为真正的数组&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// 示例 3: 转换 Set 为数组&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arrayFromSet&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;arrayFromSet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// [1, 2, 3]&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 示例 4: 转换字符串为字符数组&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;chars&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;chars&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// [&apos;h&apos;, &apos;e&apos;, &apos;l&apos;, &apos;l&apos;, &apos;o&apos;]&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 示例 6: 转换 NodeList 并提取 id&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;elements&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.item&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ids&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;elements&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;el&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;el&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ids&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 所有元素的 id 数组&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;29-arrayofes2019&quot;&gt;2.9 Array.of()（ES2019）&lt;/h3&gt;

&lt;h3 id=&quot;210-arraycopywithines2019&quot;&gt;2.10 Array.copyWithin()（ES2019）&lt;/h3&gt;

&lt;h2 id=&quot;三对象操作增强&quot;&gt;三、对象操作增强&lt;/h2&gt;

&lt;h3 id=&quot;31-展开运算符&quot;&gt;3.1 展开运算符&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Alice&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;25&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;updatedUser&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;26&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 合并并覆盖属性&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;32-objectkeys&quot;&gt;3.2 Object.keys()&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Alice&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;sex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;男&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;address&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Beijing&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;keys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// [&quot;name&quot;, &quot;age&quot;, &quot;sex&quot;, &quot;address&quot;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;33-objectvalues&quot;&gt;3.3 Object.values()&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Alice&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;sex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;男&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;address&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Beijing&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;values&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// [&quot;Alice&quot;, 18, &quot;男&quot;, &quot;Beijing&quot;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;34-objectentries&quot;&gt;3.4 Object.entries()&lt;/h3&gt;

&lt;p&gt;​用途​：对象键值遍历&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;person&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Bob&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;entries&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(([&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;: &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// &quot;name: Bob&quot;, &quot;age: 30&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;四类与模块化es6&quot;&gt;四、类与模块化（ES6+）&lt;/h2&gt;

&lt;h3 id=&quot;41-类语法增强&quot;&gt;4.1 类语法增强&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Player&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;#score&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 私有字段（ES2022）[1](@ref)&lt;/span&gt;
  
  &lt;span class=&quot;nf&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;// Getter/Setter&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;score&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;#score&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;nf&quot;&gt;addPoints&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;points&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;#score&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;points&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;player&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Player&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Alice&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;player&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;addPoints&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;player&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;score&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 10（无法直接访问 #score）&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;42-模块化es-modules&quot;&gt;4.2 模块化（ES Modules）&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// math.js&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PI&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;3.14&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// app.js&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sum&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./math.js&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 5.14&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;五其他关键新特性&quot;&gt;五、其他关键新特性&lt;/h2&gt;

&lt;h3 id=&quot;51-可选链操作符-es2020&quot;&gt;5.1 可选链操作符 ?.（ES2020）&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;address&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;city&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Beijing&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;address&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;city&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// &quot;Beijing&quot;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;contacts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// undefined（不报错）&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;52-nullish-合并-es2020&quot;&gt;5.2 Nullish 合并 ??（ES2020）&lt;/h3&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;score&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;displayScore&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;score&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;??&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;N/A&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 0（|| 会误判 0 为假值）&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;53-promiseallsettledes2020&quot;&gt;5.3 Promise.allSettled()（ES2020）&lt;/h3&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;promises&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;/api1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;/api2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)];&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;Promise&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;allSettled&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;promises&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;results&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;handleSuccessOrError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;六实践笔记&quot;&gt;六、实践笔记&lt;/h2&gt;

&lt;div class=&quot;language-markdown highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;gu&quot;&gt;## 学习日期：2025/04/16&lt;/span&gt;
&lt;span class=&quot;gu&quot;&gt;## 箭头函数&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt; 适用场景：回调函数、数组方法
&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt; 注意：避免在需要动态 &lt;span class=&quot;sb&quot;&gt;`this`&lt;/span&gt; 的场景使用（如 DOM 事件处理器）

&lt;span class=&quot;gu&quot;&gt;## 展开运算符&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt; 使用案例：合并对象 &lt;span class=&quot;sb&quot;&gt;`{ ...defaults, ...userInput }`&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt; 注意：浅拷贝问题（嵌套对象需递归处理）

&lt;span class=&quot;gu&quot;&gt;## 私有字段&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt; 语法：&lt;span class=&quot;sb&quot;&gt;`#fieldName`&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt; 限制：仅类内部可访问，子类不可继承
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;61-统计及格人数和及格率&quot;&gt;6.1 统计及格人数和及格率&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;学生成绩表有（姓名、年级、班级、学号、语文、数学、英语、化学、物理、历史、道法）这几个字段（字段名称就是中文），现在我要统计每个班的及格人数/及格率、高分人数/高分率，以及全部的及格人数/及格率、高分人数/高分率，应该怎么统计，用JS、ES6+最新版本的语法功能&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// 定义各科评分规则 (可动态配置)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;subjectConfig&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;语文&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;150&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;90&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;120&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;数学&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;150&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;90&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;135&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;英语&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;120&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;72&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;108&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;化学&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;85&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;物理&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;85&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;历史&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;85&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;道法&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;85&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 核心统计函数 (支持动态科目和规则)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;analyzeResults&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;students&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;subjectConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;subjects&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;keys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subjectConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  
  &lt;span class=&quot;c1&quot;&gt;// 初始化班级统计结构: Map&amp;lt;班级标识, 统计对象&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;classStats&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;globalStats&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;passAll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;highAny&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;reduce&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;acc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;acc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}),&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{})&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;// 遍历学生数据&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;students&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;student&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 生成班级唯一标识 (年级+班级)&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;classKey&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;student&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;年级&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;student&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;班级&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 动态初始化班级统计&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;classStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;has&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;classKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;classStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;classKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;passAll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;highAny&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;reduce&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;acc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;acc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}),&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{})&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;clsStats&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;classStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;classKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// 更新计数&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;clsStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;globalStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// 核心判断逻辑&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;isAllPassed&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;hasAnyHigh&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;nx&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;forEach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subject&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;high&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;subjectConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;score&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;student&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
      
      &lt;span class=&quot;c1&quot;&gt;// 判断单科是否及格&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;isPass&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;score&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isPass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;clsStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;globalStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;isAllPassed&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 存在一科不及格则全科不通过&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      
      &lt;span class=&quot;c1&quot;&gt;// 判断单科是否高分&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;isHigh&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;score&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isHigh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;clsStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;globalStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;hasAnyHigh&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// 更新全科/高分统计&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isAllPassed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;clsStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;passAll&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;globalStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;passAll&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hasAnyHigh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;clsStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;highAny&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;globalStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;highAny&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;// 计算比率&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;calculateRates&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;passAllRate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;passAll&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;stats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;toFixed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;highAnyRate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;highAny&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;stats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;toFixed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;entries&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;reduce&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;acc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;acc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;passRate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pass&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;stats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;toFixed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;highRate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;high&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;stats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;toFixed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}),&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{})&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;// 生成最终结构化数据&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;byClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;fromEntries&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;nb&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;classStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(([&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;classKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;stats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;classKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;calculateRates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;stats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;total&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;global&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;calculateRates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;globalStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;globalStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;entries&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;globalStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subjects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;reduce&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;acc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;acc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;passRate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pass&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;globalStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;toFixed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;highRate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;high&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;globalStats&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;total&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;toFixed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}),&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{})&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 使用示例&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;analyzeResults&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;students&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;subjectConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;数据分组&quot;&gt;数据分组&lt;/h5&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// 筛选+转换结合&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Alice&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Bob&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Charlie&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 按年龄分组：相当于array_group_by()&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;reduce&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{});&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 输出: {25: [Alice, Charlie], 30: [Bob]}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;本文档综合了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JavaScript&lt;/code&gt;的函数式编程、对象操作和类封装等最新实践，建议结合代码示例动手实验以加深理解。如需完整代码库参考，可查阅中的实战案例。&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>计算机英语</title>
   <link href="https://comeround.cn/article/computer-english.html"/>
   <updated>2025-03-30T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/computer-english</id>
   <content type="html">&lt;p&gt;popup n. 弹出窗口；弹出式窗口&lt;/p&gt;

&lt;p&gt;Unexpected adj.出乎意料的；想不到的；始料不及的&lt;/p&gt;

&lt;p&gt;fatal adj.致命的；毁灭性的；不幸的&lt;/p&gt;

&lt;p&gt;detected v. 检测到；发觉&lt;/p&gt;

&lt;p&gt;caught v. 捕获；抓住&lt;/p&gt;

&lt;p&gt;invoke v. 调用；请求；引起&lt;/p&gt;

&lt;p&gt;appgallery n. 应用商店&lt;/p&gt;

&lt;p&gt;advanced adj. 高级；先进的；进阶的&lt;/p&gt;

&lt;p&gt;flex n. 弹性；灵活性；弹性纤维&lt;/p&gt;

&lt;p&gt;justify v. 证明…是正当的；为…辩护&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>初中生物知识整理-八年级上</title>
   <link href="https://comeround.cn/article/chuzhong-sw-3.html"/>
   <updated>2025-01-08T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/chuzhong-sw-3</id>
   <content type="html">&lt;h2 id=&quot;初中八年级上册&quot;&gt;初中八年级上册&lt;/h2&gt;

&lt;h3 id=&quot;第五单元--生物圈中的其他生物&quot;&gt;第五单元  生物圈中的其他生物&lt;/h3&gt;

&lt;h4 id=&quot;第一章--动物的主要类群&quot;&gt;第一章  动物的主要类群&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;无脊椎动物：体内没有脊椎骨组成的脊柱的动物。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;包括：腔肠动物、扁形动物、线形动物、环节动物、软体动物、节肢动物。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;脊椎动物：身体内有由脊椎骨组成的脊柱&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;包括：鱼、两栖动物、爬行动物、鸟、哺乳动物&lt;/p&gt;

&lt;h5 id=&quot;1腔肠动物&quot;&gt;【1】腔肠动物&lt;/h5&gt;

&lt;p&gt;1、大多数生活在海洋中，少数种类生活在淡水中&lt;/p&gt;

&lt;p&gt;2、主要特征：身体呈辐射对称，体表有刺细胞，有口无肛门。&lt;/p&gt;

&lt;p&gt;3、代表动物：水螅、海蛰、海葵、珊瑚虫等。&lt;/p&gt;

&lt;p&gt;4、水螅的身体有内外两层细胞：内胚层和外胚层构成，中间填充着胶状物质&lt;/p&gt;

&lt;p&gt;5、食物在消化腔中消化，消化腔与口相通，消化后的食物残渣仍从口排出&lt;/p&gt;

&lt;p&gt;6、刺细胞位于外胚层，是腔肠动物特有的攻击和防御的利器，细胞里有毒液。&lt;/p&gt;

&lt;h5 id=&quot;2扁形动物&quot;&gt;【2】扁形动物&lt;/h5&gt;

&lt;p&gt;（1）主要特征：身体呈两侧对称，背腹扁平，有口无肛门。&lt;/p&gt;

&lt;p&gt;（2）代表动物：涡虫、华枝睾吸虫、血吸虫、绦虫。&lt;/p&gt;

&lt;p&gt;（3）扁形动物中自由生活的种类很少，大多数寄生在人和动物体内，如华枝睾吸虫、血吸虫、绦虫，这些寄生虫的消化器官简单，有的甚至没有专门的消化器官，但生殖器官特别发达。&lt;/p&gt;

&lt;h5 id=&quot;3线虫动物&quot;&gt;【3】线虫动物&lt;/h5&gt;

&lt;p&gt;（1）主要特征：身体细长，呈圆柱形；体表有角质层；有口有肛门。&lt;/p&gt;

&lt;p&gt;（2）代表动物：蛔虫、蛲虫、丝虫、线虫。&lt;/p&gt;

&lt;p&gt;（3）与人类的关系：多数寄生在人和动植物体内，给人类健康和经济造成危害、损失。秀丽隐杆线虫营自由生活，是重要的实验动物。&lt;/p&gt;

&lt;h5 id=&quot;4环节动物&quot;&gt;【4】环节动物&lt;/h5&gt;

&lt;p&gt;（1）主要特征：身体呈圆筒形，由许多彼此相似的体节组成；靠刚毛或疣足辅助运动。&lt;/p&gt;

&lt;p&gt;（2）代表动物：蚯蚓、水蛭、沙蚕等。&lt;/p&gt;

&lt;p&gt;蚯蚓：靠湿润的体壁呼吸。
实验时保持蚯蚓体表湿润的目的：保证蚯蚓的呼吸。&lt;/p&gt;

&lt;p&gt;（3）与人类的关系：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;①食饵：沙蚕、蚯蚓一种优良的蛋白质饲料；
②药用：蚯蚓中药称为“地龙”，活血化瘀、溶栓降压、平喘止咳；蛭可提取蛭素，生产抗血栓药物，治疗心血管病；
③改良土壤（疏松、提高肥力、促进植物根系呼吸）：蚯蚓。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;5软体动物&quot;&gt;【5】软体动物&lt;/h5&gt;

&lt;p&gt;（1）主要特征：柔软的身体表面有外套膜，大多具有贝壳；运动器官是足。&lt;/p&gt;

&lt;p&gt;（2）代表动物：河蚌、扇贝，文蛤；石鳖、蜗牛、乌贼和章鱼等。&lt;/p&gt;

&lt;p&gt;（3）与人类的关系：&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;①可食用、药用，如鱿鱼、牡蛎、鲍鱼，海螵蛸、珍珠粉；
②有些可制成工艺品，如贝壳，装饰：外套膜分泌珍珠质形成珍珠；
③有些能传播疾病，危害人类健康。如钉螺是日本血吸虫的中间寄主；
④损坏港湾建筑及交通运输设施，如船蛆；
⑤危害农作物，如蛞蝓。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;6节肢动物&quot;&gt;【6】节肢动物&lt;/h5&gt;

&lt;p&gt;（1）主要特征：体表有坚韧的外骨骼，身体和附肢都分节。&lt;/p&gt;

&lt;p&gt;外骨骼作用：①保护和支持内部柔软器官；②防止体内水分蒸发。&lt;/p&gt;

&lt;p&gt;（2）代表动物：七星瓢虫、虾、蟹、蜘蛛、蜈蚣、苍蝇、蝗虫等。&lt;/p&gt;

&lt;p&gt;（3）呼吸器官：蝗虫腹部有气门，相当于人的鼻孔，用于呼吸，气管是气体交换的场所。&lt;/p&gt;

&lt;p&gt;（4）昆虫的基本特征：一对触角、两对翅、三对足身体分头、胸、腹；昆虫是无脊椎动物中唯一会飞的动物。因而是分布最广泛的动物。&lt;/p&gt;

&lt;p&gt;（5）与人类的关系：&lt;/p&gt;

&lt;p&gt;①提供动物蛋白；②为植物传播花粉；③药用，治疗疾病；④用作实验材料；⑤有些节肢动物能传播疾病。&lt;/p&gt;

&lt;h5 id=&quot;7鱼&quot;&gt;【7】鱼&lt;/h5&gt;

&lt;p&gt;（1）适于水中生活的形态结构和生理特点：&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;①体色：背深腹浅（保护色）。
②体形：流线型，游泳时减少水的阻力。
③体表：有鳞片保护身体，有黏液减少阻力。
④鳍是鱼的运动器官。
⑤用鳃呼吸，鳃主要部分是鳃丝，鳃丝中密布毛细血管，因此鳃是鲜红色的。呼吸时，水由口进入，由鳃流出。水中氧气含量减少，二氧化碳增多。
⑥侧线：感知水流，测定方位。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;（2）主要特征：生活在水中，体表常有鳞片覆盖，用鳃呼吸，通过尾部和躯干部的摆动和鳍的协调作用游泳。
（鱼能生活在水中的特点：①靠游泳获取食物和防御敌害；②能在水中呼吸。）&lt;/p&gt;

&lt;p&gt;（3）代表动物：淡水鱼类（中华鲟、草鱼、青鱼、鲢鱼、鳙鱼&lt;四大家鱼&gt;、鲫鱼、鲤鱼）和海洋鱼类（鲨、带鱼、银鲳、魟）等。&lt;/四大家鱼&gt;&lt;/p&gt;

&lt;p&gt;（4）与人类的关系：为人类提供了富含蛋白质的食物；鱼类养殖业（主）和捕捞业是国家重要产业；文化观赏。&lt;/p&gt;

&lt;p&gt;（5）鱼类的特殊名称：海马、泥鳅、黄鳝、中华鲟等都属于鱼类。
似“鱼”而非鱼的动物：鳄鱼、甲鱼属于爬行动物；鲸鱼、海豚属于哺乳动物；章鱼、墨鱼（乌贼）、鱿鱼、鲍鱼属于软体动物；娃娃鱼（大鲵）为两栖动物。&lt;/p&gt;
&lt;h5 id=&quot;8两栖动物&quot;&gt;【8】两栖动物&lt;/h5&gt;
&lt;p&gt;（1）主要特征：幼体生活在水中，用鳃呼吸，成体大多生活在陆地上，也可在水中游泳，用肺呼吸，皮肤可辅助呼吸。&lt;/p&gt;

&lt;p&gt;（2）代表动物：大鲵（娃娃鱼）、青蛙、蟾蜍、蝾螈等。&lt;/p&gt;

&lt;p&gt;（3）身体分为头部、躯干部、四肢（无颈无尾）&lt;/p&gt;

&lt;p&gt;（4）与人类的关系：农田害虫的天敌（田间卫士）：能有效减轻农作物的虫害，以减少施用农药对环境的污染。&lt;/p&gt;

&lt;h5 id=&quot;9爬行动物&quot;&gt;【9】爬行动物&lt;/h5&gt;
&lt;p&gt;（1）主要特征：体表覆盖角质的鳞片或甲，用肺呼吸，在陆地上产卵，卵表面有坚韧的卵壳。&lt;/p&gt;

&lt;p&gt;（2）代表动物：龟、鳖、蛇、鳄。&lt;/p&gt;

&lt;p&gt;（3）身体分为头部、颈部、躯干部、四肢和尾巴。&lt;/p&gt;

&lt;p&gt;（4）鳞片可保护身体，减少水分蒸发。卵产在陆地上，生殖发育摆脱对水环境的依赖。&lt;/p&gt;

&lt;p&gt;（5）与人类的关系：食用、药用、捕食害虫。&lt;/p&gt;

&lt;p&gt;（6）被称为“活化石”的爬行动物是扬子鳄。&lt;/p&gt;

&lt;h5 id=&quot;10鸟&quot;&gt;【10】鸟&lt;/h5&gt;
&lt;p&gt;（1）主要特征：体表覆羽；前肢变成翼，有喙无齿；有气囊辅助肺呼吸。&lt;/p&gt;

&lt;p&gt;（2）家鸽适于飞行生活的形态结构和生理特点：&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;①体形：身体呈流线型，减小空气阻力。
②运动：两翼和尾部生有大型正羽，有利于飞行。
    胸肌发达，能有力地牵引翅膀搏击空气。
骨骼轻、薄、坚固，有些骨中空，可减轻体重；胸肌发达，有龙骨突，为发达的胸肌提供附着的场所。
③消化：食量大，消化能力强；直肠短，能及时排出粪便，减轻体重。
④呼吸：用肺和气囊辅助进行双重呼吸，可获得充足的氧气。
⑤循环：心脏四腔，输送氧的能力增强，有利于有机物的分解。体温恒定。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;（3）体温不随环境温度的变化而改变的动物，叫恒温动物。主要包括鸟类和哺乳动物。体温会随环境温度的变化而改变的动物，叫变温动物。如：鱼、两栖动物、爬行动物等。恒定的体温增强了动物对环境的适应能力，扩大了动物的分布范围。&lt;/p&gt;

&lt;p&gt;（4）与人类的关系：为人类提供肉、蛋等产品；帮助人类控制害虫、害鼠；药用；科学研究价值；观赏价值。&lt;/p&gt;
&lt;h5 id=&quot;11哺乳动物&quot;&gt;【11】哺乳动物&lt;/h5&gt;
&lt;p&gt;（1）主要特征：体表被毛，胎生、哺乳；牙齿分门齿、犬齿和臼齿的分化。&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;a. 有体毛——保温作用。
b. 胎生、哺乳提高后代的成活率。
c. 牙齿分为门齿（切断食物）、犬齿（撕裂肉食）和臼齿（磨碎食物）。
狼（肉食动物）有门齿、臼齿、犬齿，犬齿发达。
牙齿的分化提高哺乳动物的摄取食物的能力，增强对食物的消化能力。
d. 发达的神经系统和感觉器官，感知外界环境，对环境的复杂多变做出及时反应。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;（2）代表动物：猕猴、野马、非洲象、鲸等，非洲象是陆地上最大的哺乳动物。&lt;/p&gt;

&lt;p&gt;（3）与人类的关系：&lt;/p&gt;

&lt;p&gt;①有利方面：食用；动物的皮毛可制作服饰；人类的得力助手；作为宠物。
②有害方面：鼠类猖獗会对农、林、牧业造成危害，传播疾病；狼会对牧业造成威胁。&lt;/p&gt;

&lt;h4 id=&quot;第二章--动物的运动和行为&quot;&gt;第二章  动物的运动和行为&lt;/h4&gt;

&lt;h5 id=&quot;1动物的运动&quot;&gt;【1】动物的运动&lt;/h5&gt;
&lt;p&gt;（1）运动系统组成及功能
运动系统：由骨、关节和肌肉（骨骼肌）构成。骨骼肌由肌腱和肌腹构成。&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;骨——杠杆作用&lt;/li&gt;
  &lt;li&gt;关节——支点作用&lt;/li&gt;
  &lt;li&gt;骨骼肌——连结和动力作用&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;（2）运动的产生：骨骼肌受神经传来的刺激收缩时，就会牵动骨绕关节活动，于是躯体的相应部位就会产生运动。&lt;/p&gt;

&lt;p&gt;（3）运动并不是仅靠运动系统就能完成，还需要其他系统如神经系统的调节，运动所需的能量，有赖于消化系统、呼吸系统、循环系统的配合。
运动的意义：有利于动物寻觅食物、躲避敌害、争夺栖息地和繁殖后代。&lt;/p&gt;

&lt;p&gt;（4）屈肘时：肱二头肌①收缩，②肱三头肌舒张。
伸肘时：②肱三头肌收缩，①肱二头肌舒张。&lt;/p&gt;

&lt;p&gt;（5）关节腔内有滑液，作用是减少摩擦。关节软骨的作用是减少摩擦和缓冲作用。关节囊具有连接、保护、分泌滑液功能。&lt;/p&gt;
&lt;h5 id=&quot;2先天性行为和学习行为&quot;&gt;【2】先天性行为和学习行为&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;（1）先天性行为：动物生来就有的，由遗传物质所决定的行为，就是动物的先天性行为。
    &lt;ul&gt;
      &lt;li&gt;如：幼袋鼠爬向母袋鼠的育儿袋、小鸟喂鱼、蜜蜂采蜜、蜘蛛结网、鸟类迁徙、公鸡报晓、孔雀开屏等。&lt;/li&gt;
      &lt;li&gt;优点：使动物能适应环境，得以生存和繁殖后代。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;（2）学习行为：在遗传因素的基础上，通过环境因素的作用，由生活经验和学习获得的行为。
如：老马识途、狗辨主客、鹦鹉学舌、海豚表演、蚯蚓走“T”字迷宫、大山雀偷饮牛奶、成年黑猩猩取香蕉等。
优点：使动物能更好的适应复杂环境的变化。动物越高等，学习能力越强，行为越复杂。&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;3社会行为&quot;&gt;【3】社会行为&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;（1）营群体生活的动物会形成一个社会，具有一系列的社会行为。如：白蚁、蜜蜂的群体、狒狒等。&lt;/li&gt;
  &lt;li&gt;（2）社会行为的主要特征：具有社会行为的动物，群体内形成一定的组织，成员间有明确的分工，有的群体还形成等级。&lt;/li&gt;
  &lt;li&gt;（3）群体的信息交流：动物的动作、声音和气味都能够起到传递信息的作用。
意义：在群体觅食、御敌和繁衍后代等方面都有重要意义。&lt;/li&gt;
  &lt;li&gt;（4）在自然界，生物间的信息交流普遍存在。正是由于物质流、能量流和信息流的存在，使生物之间的联系错综复杂，牵一发而动全身，生物与环境才成为统一的整体。&lt;/li&gt;
  &lt;li&gt;（5）社会行为&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;第三章--动物在生物圈中的作用&quot;&gt;第三章  动物在生物圈中的作用&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;生态平衡：在生态系统中生物的种类、各种生物的数量和所占的比例总是维持在相当稳定状态叫生态平衡。&lt;/li&gt;
  &lt;li&gt;在自然生态系统中，各种生物之间，生物与环境之间存在相互依赖、相互制约的关系。&lt;/li&gt;
  &lt;li&gt;动物在自然界中作用：①维持生态平衡。②促进生态系统的物质循环（作为消费者）。③帮助植物传粉、播种。&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;第四章--细菌和真菌&quot;&gt;第四章  细菌和真菌&lt;/h4&gt;

&lt;h5 id=&quot;1细菌和真菌的分布&quot;&gt;【1】细菌和真菌的分布&lt;/h5&gt;
&lt;ol&gt;
  &lt;li&gt;培养细菌和真菌的一般方法：配制培养基→高温灭菌→冷却→接种→恒温培养。&lt;/li&gt;
  &lt;li&gt;由一个细菌或真菌繁殖后形成的肉眼可见的集合体称为菌落。
    &lt;ul&gt;
      &lt;li&gt;细菌菌落特点：较小；表面或光滑黏稠，或粗糙干燥；多呈白色。&lt;/li&gt;
      &lt;li&gt;真菌菌落特点：比细菌菌落大几倍到几十倍；多呈绒毛状、絮状或蜘蛛网状；有的还呈红、褐、绿、黑、黄等不同颜色。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;细菌和真菌的生物圈中广泛分布的生物。细菌和真菌的生活条件：水分、适宜的温度、有机物等。（有的还要求某些特定的条件，如有些细菌必须在无氧条件下生存。）&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;2细菌&quot;&gt;【2】细菌&lt;/h5&gt;
&lt;ol&gt;
  &lt;li&gt;细菌的发现者是列文虎克。
    &lt;ul&gt;
      &lt;li&gt;“微生物学之父”：巴斯德。&lt;/li&gt;
      &lt;li&gt;巴斯德的鹅颈瓶实验证实了细菌不是自然发生的，而是由原来已经存在的细菌产生的。巴斯德还发现了乳酸菌、酵母菌，提出了保存酒和牛奶的巴氏消毒法以及防止手术感染的方法。&lt;/li&gt;
      &lt;li&gt;细菌的形态：球状、杆状、螺旋状。&lt;/li&gt;
      &lt;li&gt;细菌的结构：细胞壁、细胞膜、细胞质、DNA、有的有鞭毛和荚膜。没有成形的细胞核（属原核生物）、没有叶绿体。&lt;/li&gt;
      &lt;li&gt;细菌的生殖方式：分裂生殖（速度快）&lt;/li&gt;
      &lt;li&gt;细菌的营养方式：大多数为异养（腐生和寄生）。&lt;/li&gt;
      &lt;li&gt;细菌快速繁殖和形成芽孢的特性，使它们几乎无处不在。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;芽孢是细菌的休眠体，不是生殖细胞，对不良环境有较强的抵抗力，落在适当的环境中又能萌发成细菌。所有的细菌都是单细胞生物。&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;3真菌&quot;&gt;【3】真菌&lt;/h5&gt;
&lt;ol&gt;
  &lt;li&gt;酵母菌为单细胞真菌。
    &lt;ul&gt;
      &lt;li&gt;霉菌（引起食物发霉的真菌为霉菌）、食用菌、大型真菌为多细胞真菌。&lt;/li&gt;
      &lt;li&gt;青霉菌孢子的着生状态呈扫帚状。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;真菌的结构：细胞壁、细胞膜、细胞质、细胞核等，细胞中都没有叶绿体。
    &lt;ul&gt;
      &lt;li&gt;真菌的营养方式：异养。&lt;/li&gt;
      &lt;li&gt;真菌的生殖方式：孢子生殖，酵母菌还可以进行出芽生殖。&lt;/li&gt;
      &lt;li&gt;细菌和真菌细胞内没有叶绿体，不能自己制造有机物，靠现成的有机物生活，是生态系统中的分解者。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;4细菌和真菌在自然界中的作用&quot;&gt;【4】细菌和真菌在自然界中的作用&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;（1）作为分解者参与物质循环（营腐生生活）；细菌和真菌把动植物遗体分解成二氧化碳，水，无机盐。&lt;/li&gt;
  &lt;li&gt;（2）引起动植物和人患病（营寄生生活）；&lt;/li&gt;
  &lt;li&gt;（3）与动植物共生（营共生生活）：地衣（真菌和藻类共生），根瘤（根瘤菌与植物共生，根瘤菌能固氮）。&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;5人类对细菌和真菌的利用&quot;&gt;【5】人类对细菌和真菌的利用：&lt;/h5&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;乳酸菌——制泡菜
青霉菌——产生青霉素
苏云金杆菌——细菌杀虫剂
甲烷菌——净化污水、生成甲烷
酵母菌——制作馒头，面包
枯草杆菌——引起水果腐烂
链球菌——使人患扁桃体炎
根瘤菌——固氮作用
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;1、防止食品腐败所依据的主要原理是：把食品内的细菌和真菌杀死或抑制它们的生长和繁殖。
保存食品的几种方法：&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;脱水法——干蘑菇
腌制法——咸肉
烟熏法——腊肉
真空包装法——袋装肉肠
巴斯消毒法——盒装牛奶
渗透保存法——果脯
罐藏法——罐头
冷藏和冷冻——肉类、鱼类
防腐剂法——添加山梨酸钾、苯甲酸钠、脱氢乙酸钠
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;2、疾病防治：英国细菌学家弗莱明发明抗生素。&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;青霉菌→青霉素&lt;/li&gt;
  &lt;li&gt;大肠杆菌→胰岛素&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;3、净化环境：厌氧菌将有机物分解产生甲烷。好氧菌产生二氧化碳和水。&lt;/p&gt;

&lt;h4 id=&quot;第五章--病毒&quot;&gt;第五章  病毒&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;病毒比细菌小得多，在电子显微镜下才能看到。病毒不能独立生活，必须寄生在其他生物的细胞内。&lt;/li&gt;
  &lt;li&gt;病毒的结构：蛋白质外壳和内部的遗传物质组成，没有细胞结构。&lt;/li&gt;
  &lt;li&gt;病毒与人类生活的关系有利也有弊。&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;第六单元--生物多样性&quot;&gt;第六单元  生物多样性&lt;/h3&gt;

&lt;h4 id=&quot;第一章--生物分类&quot;&gt;第一章  生物分类&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;植物的分类：藻类植物、苔藓植物、蕨类植物、裸子植物、被子植物。&lt;/li&gt;
  &lt;li&gt;动物的分类：
    &lt;ul&gt;
      &lt;li&gt;无脊椎动物：腔肠动物、扁形动物、线虫动物、环节动物、软体动物、节肢动物&lt;/li&gt;
      &lt;li&gt;脊椎动物：鱼、两栖动物、爬行动物、鸟、哺乳动物&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;其他生物的分类：
    &lt;ul&gt;
      &lt;li&gt;细菌：球菌、杆菌、螺旋菌&lt;/li&gt;
      &lt;li&gt;真菌：单细胞真菌、多细胞真菌&lt;/li&gt;
      &lt;li&gt;病毒：动物病毒、植物病毒、细菌病毒&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;生物分类从大到小的等级依次是界、门、纲、目、科、属、种。&lt;/li&gt;
  &lt;li&gt;“种”是最基本的分类单位，同种生物的亲缘关系是最密切的。&lt;/li&gt;
  &lt;li&gt;分类等级规律：分类单位越大，包含物种越多，但物种间的相似程度越小，亲缘关系越远；分类单位越小，包含的物种越少，而相似特征越多，同种生物的亲缘关系是最密切的。&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;第二章-认识生物的多样性&quot;&gt;第二章 认识生物的多样性&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;生物的多样性内涵包括三个层次：生物种类的多样性，基因的多样性和生态系统的多样性。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;三者关系:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;(1)基因多样性决定种类多样性，种类多样性实质是基因多样性；&lt;/li&gt;
  &lt;li&gt;(2)生物种类多样性影响生态系统的多样性；&lt;/li&gt;
  &lt;li&gt;(3)生态系统发生剧烈变化时也会加速生物种类多样性和基因多样性的丧失，所以保护生物多样性的根本措施是保护生物的栖息环境（如建立自然保护区），保护生态系统的多样性。&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
  &lt;li&gt;我国是裸子植物最丰富的国家，被称为“裸子植物的故乡”。苔藓、蕨类和种子植物居世界第三位。&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;第三章-保护生物的多样性&quot;&gt;第三章 保护生物的多样性&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;造成生物多样性面临威胁的原因有：
    &lt;ul&gt;
      &lt;li&gt;（1）生态环境改变和破坏；&lt;/li&gt;
      &lt;li&gt;（2）掠夺式开发利用；&lt;/li&gt;
      &lt;li&gt;（3）环境污染；&lt;/li&gt;
      &lt;li&gt;（4）外来生物入侵。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;建立自然保护区：
    &lt;ul&gt;
      &lt;li&gt;含义：是指含有保护对象在内的一定面积的陆地或水体划分出来进行保护和管理，这个区域就是自然保护区。&lt;/li&gt;
      &lt;li&gt;功能：自然保护区是“天然基因库”，是进行科学研究的“天然实验室”，是“活的自然博物馆”。&lt;/li&gt;
      &lt;li&gt;目的：&lt;/li&gt;
    &lt;/ul&gt;
    &lt;ul&gt;
      &lt;li&gt;①保护生态系统；&lt;/li&gt;
      &lt;li&gt;②保护珍稀动植物。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;建立自然保护区是保护生物多样性最为有效的措施。&lt;/li&gt;
  &lt;li&gt;保护生物多样性的主要措施：
    &lt;ul&gt;
      &lt;li&gt;①建立自然保护区；&lt;/li&gt;
      &lt;li&gt;②迁地保护；&lt;/li&gt;
      &lt;li&gt;③建立种子库、精子库；&lt;/li&gt;
      &lt;li&gt;④法律保护。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;为保护生物多样性，我国相继颁布的法律和文件：《中华人民共和国森林法》、《中华人民共和国野生动物保护法》、《中国自然保护纲要》。我国还是最先加入国际《保护生物多样性公约》的国家之一。&lt;/li&gt;
  &lt;li&gt;被称为植物中的“活化石”是银杉和中国鸽子树（珙桐）；
    &lt;ul&gt;
      &lt;li&gt;被称为中生代动物的“活化石”的是扬子鳄。&lt;/li&gt;
      &lt;li&gt;我国特有的珍稀动物有:金丝猴、白鳍豚、朱鹮、扬子鳄&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;作为一名公民，在保护我国的生物多样性方面，应当如何做？&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
  &lt;li&gt;①人人都来植树造林；&lt;/li&gt;
  &lt;li&gt;②开展爱鸟周活动；&lt;/li&gt;
  &lt;li&gt;③人人都来消灭白色垃圾；&lt;/li&gt;
  &lt;li&gt;④不随地吐痰，不随意打鸟，不攀折花木等。&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Web神器之Selenium</title>
   <link href="https://comeround.cn/article/selenium.html"/>
   <updated>2025-01-03T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/selenium</id>
   <content type="html">&lt;h2 id=&quot;一什么是selenium&quot;&gt;一、什么是Selenium&lt;/h2&gt;

&lt;p&gt;Selenium是一个用于Web应用程序自动化测试的工具集，它提供了多种编程语言（如Python、Java、C#等）的接口，使得开发者能够通过编写代码来模拟用户在浏览器中的操作。在Python环境中使用Selenium，就可以利用Python语言的简洁性和强大的库生态系统，实现高效的Web自动化任务。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Selenium在Python中的应用场景：&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;自动化测试：对Web应用程序的功能进行自动化测试，例如验证页面元素是否正确显示、表单提交是否成功、链接跳转是否正常等。通过编写测试脚本，可以快速且重复地执行这些测试，提高测试效率和准确性。&lt;/li&gt;
  &lt;li&gt;数据抓取：当网页数据是通过JavaScript动态加载时，传统的网页爬虫（如BeautifulSoup）可能无法直接获取到数据。Selenium可以模拟浏览器加载页面的过程，等待数据完全加载后再进行抓取，从而获取到完整的网页数据。&lt;/li&gt;
  &lt;li&gt;网页交互模拟：模拟用户在网页上的操作，如点击按钮、填写表单、滚动页面等。这在一些需要模拟用户行为的场景中非常有用，例如自动化注册流程、模拟登录操作等。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;二学习笔记&quot;&gt;二、学习笔记&lt;/h2&gt;

&lt;h5 id=&quot;1-基本使用打开一个网页&quot;&gt;1. 基本使用：打开一个网页&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;selenium&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;webdriver&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;selenium.webdriver.common.by&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;By&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 初始化WebDriver
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;driver&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;webdriver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Chrome&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 打开页面
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;https://www.douyin.com/discover&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 关闭浏览器
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;quit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;2-填充表单数据&quot;&gt;2. 填充表单数据&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 找到用户名和密码输入框并输入信息
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;username_input&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;find_element&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;By&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ID&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;userName&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;password_input&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;find_element&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;By&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ID&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;pwd&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 向&amp;lt;input&amp;gt;元素写入数据，这里以“admin”为例
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;username_input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;send_keys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;admin&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;password_input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;send_keys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;123456&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;3-点击事件&quot;&gt;3. 点击事件&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 点击登录按钮：定位到&amp;lt;a&amp;gt;标签元素，这里假设登录链接的文本是“登录”
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;login_link&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;find_element&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;By&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CSS_SELECTOR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;a[class=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;login_link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;4-获取cookie&quot;&gt;4. 获取Cookie&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;cookies&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get_cookies&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cookie&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cookies&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# 打印所有Cookie
&lt;/span&gt;    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# 获取指定的Cookie
&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;authorization_token&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;s_token&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;获取到的Token为：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s_token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 获取Cookie字符串
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cookie&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;; &lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cookie&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cookies&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;5-打开新网页&quot;&gt;5. 打开新网页&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 新建一个窗口（tab）
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;execute_script&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;window.open(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;switch_to&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;window_handles&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 打开第一个网址
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;http://www.gzwy.gov.cn/&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;6-页面刷新&quot;&gt;6. 页面刷新&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;driver&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;refresh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;三案例&quot;&gt;三、案例&lt;/h2&gt;

&lt;h3 id=&quot;1正在编写中&quot;&gt;（1）正在编写中&lt;/h3&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# TODO
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Pandas应用</title>
   <link href="https://comeround.cn/article/pandas-apply.html"/>
   <updated>2024-12-26T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/pandas-apply</id>
   <content type="html">&lt;h2 id=&quot;一简介&quot;&gt;一、简介&lt;/h2&gt;

&lt;p&gt;Pandas是Python语言的一个扩展程序库，专门用于数据分析。Pandas提供了高性能、易于使用的数据结构和数据分析工具。
它可以从各种文件格式如CSV、JSON、SQL、Microsoft Excel等导入数据。&lt;/p&gt;

&lt;p&gt;Pandas广泛应用在学术、金融、统计学等各个数据分析领域。它提供了一个简单、高效的数据处理框架，使得数据清洗、转换、分析和可视化变得更加容易。&lt;/p&gt;

&lt;h2 id=&quot;二学习笔记&quot;&gt;二、学习笔记&lt;/h2&gt;

&lt;h5 id=&quot;2-数据预览与检查&quot;&gt;2. 数据预览与检查&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 基本信息
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;# 查看前5行
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;tail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;# 查看后5行
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;# 查看数据表信息
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;describe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# 数值列统计摘要
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shape&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;# 数据表维度df.columns#列名
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dtypes&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;# 每列的数据类型
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;3-数据清洗&quot;&gt;3. 数据清洗&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 缺失值处理
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;isnull&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;                 &lt;span class=&quot;c1&quot;&gt;# 每列的缺失值数量
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;fillna&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;                      &lt;span class=&quot;c1&quot;&gt;# 用填充缺失值
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dropna&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;                       &lt;span class=&quot;c1&quot;&gt;# 删除包含缺失值的行
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dropna&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;subset&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;column_name&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# 删除指定列有缺失值的行
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;rename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;columns&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;old name&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;new name&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inplace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# 重命名列
&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 删除行或列
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;drop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;columns&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col1&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col2&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;inplace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# 删除列
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;drop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;，&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inplace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;            &lt;span class=&quot;c1&quot;&gt;# 删除行
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;reset_index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;drop&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inplace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;        &lt;span class=&quot;c1&quot;&gt;# 重置索引
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;4-数据选择与过滤&quot;&gt;4. 数据选择与过滤&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 选择列
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;column name&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# 单列
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col1&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;，&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col2&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]]&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# 多列
# 选择行
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iloc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;           &lt;span class=&quot;c1&quot;&gt;# 按位置
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;loc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;column name&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; 
&lt;span class=&quot;c1&quot;&gt;# 按条件
# 条件过滤
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col1&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col2&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# 多条件
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;5-数据变换&quot;&gt;5. 数据变换&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 创建新列
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;new_col&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col1&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col2&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 数据类型转换
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;astype&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 字符串操作
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;upper&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;                  &lt;span class=&quot;c1&quot;&gt;# 转为大写
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;contains&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;keyword&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;# 判断包含关键词
# 日期操作
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;date col&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;datetime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;date col&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# 转为日期格式
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;year&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;     &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;date_col&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;year&lt;/span&gt;          &lt;span class=&quot;c1&quot;&gt;# 提取年份
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;month&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;date col&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;month&lt;/span&gt;         &lt;span class=&quot;c1&quot;&gt;# 提取月份
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;6-分组与聚合分组统计&quot;&gt;6. 分组与聚合#分组统计&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;groupby&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;value_col&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mean&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;# 按列分组求均值
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;groupby&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col1&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col2&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;       &lt;span class=&quot;c1&quot;&gt;# 多列分组求和
# 透视表
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;pivot_table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;values&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;value_col&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col1&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;columns&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col2&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;aggfunc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;7-可视化&quot;&gt;7. 可视化&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;seaborn&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sns&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 简单绘图
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;plot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;hist&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;           &lt;span class=&quot;c1&quot;&gt;# 直方图
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# Seaborn 示例
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;barplot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col1&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;，&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col2&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;，&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;           &lt;span class=&quot;c1&quot;&gt;# 条形图
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;heatmap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;corr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;，&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;annot&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cmap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;coolwarm&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# 热力图
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;8-高级分析-数据透视表&quot;&gt;8. 高级分析# 数据透视表&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pivot&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;values&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col1&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;columns&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;col2&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;aggfunc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 合并数据
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;merge&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df1&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;，&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df2&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;，&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;          &lt;span class=&quot;c1&quot;&gt;# 按键合并
# 数据透视或多级索引df.set index([&apos;col1&apos;,&apos;col2&apos;]).sort index()
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;9-时间序列分析&quot;&gt;9. 时间序列分析&lt;/h5&gt;
&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;#设置日期索引
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;datetime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;set_index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;inplace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 时间序列可视化df[&apos;value&apos;].plot()plt.show()
# 滑动平均df[&apos;rolling mean&apos;]= df[&apos;value&apos;].rolling(window=7).mean()
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;10-数据导出与保存&quot;&gt;10. 数据导出与保存&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 保存数据
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;to_csv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;output.csv&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;to_excel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;output.xlsx&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;三案例&quot;&gt;三、案例&lt;/h2&gt;

&lt;h3 id=&quot;1读取excel并从身份证号码中获取到出生日期&quot;&gt;（1）读取Excel并从身份证号码中获取到出生日期&lt;/h3&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pandas&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 读取Excel文件到DataFrame
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;read_excel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;pandas.xlsx&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sheet_name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Sheet1&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 函数：获取出生日期
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get_birth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id_number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id_number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id_number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id_number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;出生日期&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;身份证号码&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;apply&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get_birth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 如果需要保存结果到新的Excel文件中
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;to_excel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;verified_data.xlsx&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>【信息科技清华版】学习笔记</title>
   <link href="https://comeround.cn/article/xinxi-keji-note.html"/>
   <updated>2024-10-08T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/xinxi-keji-note</id>
   <content type="html">&lt;p&gt;本套教材的主要内容有：认识计算机、算法及其实现、网络及其应用、物联网入门、信息处理和认识数据科学、人工智能、跨学科主题。
&lt;!-- 在上一套教材中，出现过“计算机选购”的内容，本套教材则偏向于“国产化”。 --&gt;&lt;/p&gt;

&lt;h2 id=&quot;一教材资源&quot;&gt;一、教材资源&lt;/h2&gt;

&lt;p&gt;《信息科技》清华大学出版社贵州版&lt;/p&gt;

&lt;p&gt;电子教材： &lt;a href=&quot;https://cdn.fe80.cn/uploads/xinxikeji-tsinghua/%E4%BF%A1%E6%81%AF%E7%A7%91%E6%8A%80%E6%95%99%E6%9D%90-%E4%B8%83%E5%B9%B4%E7%BA%A7%E4%B8%8A%E5%86%8C.pdf&quot;&gt;七年级上册&lt;/a&gt; &lt;a href=&quot;https://cdn.fe80.cn/uploads/xinxikeji-tsinghua/%E4%BF%A1%E6%81%AF%E7%A7%91%E6%8A%80%E6%95%99%E6%9D%90-%E5%85%AB%E5%B9%B4%E7%BA%A7%E4%B8%8A%E5%86%8C.pdf&quot;&gt;八年级上册&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;参考资料： &lt;a href=&quot;https://wqxuetang-public.oss-cn-beijing.aliyuncs.com/qhytl/gzb/%E4%B8%83%E4%B8%8A.zip&quot;&gt;七年级上册&lt;/a&gt; &lt;a href=&quot;https://wqxuetang-public.oss-cn-beijing.aliyuncs.com/qhytl/gzb/%E5%85%AB%E4%B8%8A.zip&quot;&gt;八年级上册&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;学习网站： &lt;a href=&quot;https://wqbook.wqxuetang.com/qhytl/download.html&quot;&gt;清华大学“大、中、小学一条龙”教研网&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;二资源下载&quot;&gt;二、资源下载&lt;/h2&gt;

&lt;h3 id=&quot;1软件下载&quot;&gt;（1）软件下载&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://cdn.fe80.cn/uploads/xinxikeji-tsinghua/xmind-8-windows-wm_3.7.3.201708241944.exe&quot;&gt;XMind8&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://cdn.fe80.cn/uploads/xinxikeji-tsinghua/%E5%9B%BE%E6%8B%89%E4%B8%81%E7%A1%AC%E4%BB%B6%E6%A3%80%E6%B5%8B.zip&quot;&gt;图拉丁硬件检测&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://cdn.fe80.cn/uploads/xinxikeji-tsinghua/thonny-py38-4.1.2.exe&quot;&gt;Thonny4.1.2&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;(官方)&lt;a href=&quot;https://github.com/thonny/thonny/releases/download/v4.1.6/thonny-4.1.6.exe&quot;&gt;Thonny4.1.6&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;(官方)&lt;a href=&quot;https://download.virtualbox.org/virtualbox/6.1.14/VirtualBox-6.1.14-140239-Win.exe&quot;&gt;VirtualBox&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://down10.zol.com.cn/gongju/VMwareWorkstationLite17.0.1.zip&quot;&gt;VMware17&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;(官方)&lt;a href=&quot;https://www.mpython.cn/software&quot;&gt;mPython下载&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;2系统镜像下载&quot;&gt;（2）系统镜像下载&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;建议使用&lt;a href=&quot;https://www.xunlei.com/&quot;&gt;迅雷&lt;/a&gt;下载&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;(华为云镜像)&lt;a href=&quot;https://mirrors.huaweicloud.com/ubuntu-releases/20.04.6/ubuntu-20.04.6-desktop-amd64.iso&quot;&gt;Ubuntu20.04.6&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;(阿里云镜像)&lt;a href=&quot;https://mirrors.aliyun.com/ubuntu-releases/mantic/ubuntu-23.10.1-desktop-amd64.iso&quot;&gt;Ubuntu23.10.1&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;(清华大学镜像)&lt;a href=&quot;https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/24.10/ubuntu-24.10-desktop-amd64.iso&quot;&gt;Ubuntu24.10.1&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;(官方)&lt;a href=&quot;https://www.openkylin.top/downloads/&quot;&gt;开源麒麟操作系统&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;(官方)&lt;a href=&quot;https://www.chinauos.com/resource/download-professional&quot;&gt;统信UOS&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;(官方)&lt;a href=&quot;https://www.deepin.org/zh/download/&quot;&gt;深度Deepin&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;(官方)&lt;a href=&quot;https://repo.openeuler.org/&quot;&gt;华为欧拉操作系统&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Windows系统资源下载&lt;/strong&gt; ：&lt;a href=&quot;https://msdn.itellyou.cn/&quot;&gt;ITELLYOU&lt;/a&gt; | &lt;a href=&quot;https://next.itellyou.cn/&quot;&gt;NEXT, ITELLYOU&lt;/a&gt; | &lt;a href=&quot;https://hellowindows.cn/&quot;&gt;HelloWindows&lt;/a&gt; | &lt;a href=&quot;https://www.xitongku.com/&quot;&gt;系统库&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Win装机启动盘&lt;/strong&gt; ：&lt;a href=&quot;https://www.laomaotao.net/&quot;&gt;老毛桃&lt;/a&gt; | &lt;a href=&quot;http://www.winbaicai.com/&quot;&gt;大白菜&lt;/a&gt; | &lt;a href=&quot;https://uqitong.com/&quot;&gt;U启通&lt;/a&gt; | &lt;a href=&quot;https://www.weipe.com/index.html&quot;&gt;微PE&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;3其他资源&quot;&gt;（3）其他资源&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;【视频】&lt;a href=&quot;https://cdn.fe80.cn/uploads/xinxikeji-tsinghua/%E4%B8%8D%E4%B8%80%E6%A0%B7%E7%9A%84%E8%AE%A1%E7%AE%97%E6%9C%BA.mp4&quot;&gt;不一样的计算机&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;【视频】&lt;a href=&quot;https://www.bilibili.com/video/BV1ncvQeoE36/?vd_source=b4cbef33082803b8a72a6d48a2261c7e&quot;&gt;VirtualBox配置安装Ubuntu虚拟机&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;【视频】&lt;a href=&quot;https://www.xiaohongshu.com/explore/65faa861000000001203d359&quot;&gt;安装国产Linux openeuler open欧拉&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;4学习网站&quot;&gt;（4）学习网站&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;【网站学习Python】：&lt;a href=&quot;https://www.runoob.com/python3/python3-tutorial.html&quot;&gt;菜鸟教程&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;【视频学习Python】：&lt;a href=&quot;https://search.bilibili.com/all?keyword=python&quot;&gt;B站&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;5人工智能工具&quot;&gt;（5）人工智能工具&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://tongyi.aliyun.com/qianwen/&quot;&gt;通义千问&lt;/a&gt; https://tongyi.aliyun.com/qianwen/&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://kimi.moonshot.cn/&quot;&gt;KimiAi&lt;/a&gt; https://kimi.moonshot.cn/&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://yiyan.baidu.com/&quot;&gt;文心一言&lt;/a&gt; https://yiyan.baidu.com/&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://yuanbao.tencent.com/&quot;&gt;腾讯元宝&lt;/a&gt; https://yuanbao.tencent.com/&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.doubao.com/&quot;&gt;抖音豆包&lt;/a&gt; https://www.doubao.com/&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://chatglm.cn/main/alltoolsdetail?lang=zh&quot;&gt;智谱清言&lt;/a&gt; https://chatglm.cn/main/alltoolsdetail?lang=zh&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.coze.cn/&quot;&gt;扣子AI&lt;/a&gt; https://www.coze.cn/&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://xinghuo.xfyun.cn/&quot;&gt;讯飞星火&lt;/a&gt; https://xinghuo.xfyun.cn/&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;三代码整理&quot;&gt;三、代码整理&lt;/h2&gt;

&lt;p&gt;Python常用的扩展模块有&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;numpy&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;scipy&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pandas&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;matplotlib&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Jupyter Notebook&lt;/code&gt;的使用
    &lt;ul&gt;
      &lt;li&gt;安装：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pip install notebook&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;启动：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jupyter notebook --ip=0.0.0.0 --port=18650 --notebook-dir=/www/jupyterfile --allow-root&lt;/code&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;代码1-p54代码&quot;&gt;代码1 P54代码&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;info&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;输入的内容是&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;输出的内容是&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;代码2-p55代码&quot;&gt;代码2 P55代码&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;代码3-p56代码&quot;&gt;代码3 P56代码&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;answer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;请输入3+5的答案：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;你的答案是：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;answer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;正确答案是：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;代码4723计算矩形周长参考代码&quot;&gt;代码4：7.2.3计算矩形周长参考代码&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 7.2.3计算矩形周长参考代码
&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# float函数表示将输入的字符信息，转换为浮点数
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;recLenth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;请输入矩形的长：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;recWidth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;请输入矩形的宽：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;perimeter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;recLenth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;recWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;长宽分别为：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;recLenth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;recWidth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;的矩形周长为：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;perimeter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;代码生成二维码信息&quot;&gt;代码：生成二维码信息&lt;/h5&gt;

&lt;p&gt;若未安装qrcode，使用命令&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pip install qrcode&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;qrcode&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;img&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;qrcode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;make&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;二维码存储的信息&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;test.png&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;wb&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;img&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;save&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;猜数字游戏-p49体验&quot;&gt;猜数字游戏 P49体验&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;random&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 生成1到100之间的一个随机数
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;secret_number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;randint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;guess&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;attempts&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;我已经想好了一个1到100之间的数字。你能猜到是多少吗？&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;guess&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;secret_number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# 获取用户的猜测
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;guess&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;请输入你的猜测：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;attempts&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# 给出提示
&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;guess&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;secret_number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;太低了！再试试看。&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;guess&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;secret_number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;太高了！再试试看。&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 猜测正确
&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;恭喜你！你在&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;attempts&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;次尝试后猜对了数字 &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;secret_number&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;！&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;计算以下程序的运行结果-p60练习题&quot;&gt;计算以下程序的运行结果 P60练习题&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;65&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;编写程序输入圆柱的地面半径和高-1求圆柱的体积-2求圆柱的表面积&quot;&gt;编写程序：输入圆柱的地面半径和高 (1)求圆柱的体积 (2)求圆柱的表面积&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;请输入下底的半径：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;请输入圆柱的高：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;3.14&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;下底半径为 &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;、高为 &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; 的圆柱，体积为 &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>阿里云函数计算</title>
   <link href="https://comeround.cn/article/fc.html"/>
   <updated>2024-07-17T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/fc</id>
   <content type="html">&lt;h2 id=&quot;一方法说明&quot;&gt;一、方法说明&lt;/h2&gt;

&lt;h2 id=&quot;二功能使用&quot;&gt;二、功能使用&lt;/h2&gt;

&lt;h6 id=&quot;全局变量&quot;&gt;全局变量&lt;/h6&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$counter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;preStop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$GLOBALS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;fcLogger&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;preStop ok&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;handler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;global&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$counter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$counter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$counter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h6 id=&quot;获取请求参数&quot;&gt;获取请求参数&lt;/h6&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;body&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getBody&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getContents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;queries&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getQueryParams&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//数组&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;method&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;     &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// `GET`&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;headers&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getHeaders&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// &quot;Host&quot;:[&quot;fc.fe80.cn&quot;]&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;path&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;path&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// `/aa/bb/cc`&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;requestURI&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;requestURI&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// `/aa/bb/cc?name=bb`&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$info&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;clientIP&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;   &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;clientIP&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// `116.171.4.22`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h6 id=&quot;无密码操作对象存储&quot;&gt;无密码操作对象存储&lt;/h6&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;RingCentral\Psr7\Response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;OSS\OssClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;OSS\Core\OssException&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;handler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Response&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$credentials&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;credentials&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$resbody&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;oss&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;list&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getObjectList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$credentials&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
            &lt;span class=&quot;s1&quot;&gt;&apos;X-Powered-By&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;nginx/1.28.0&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;s1&quot;&gt;&apos;Content-Type&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;application/json&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;s1&quot;&gt;&apos;Access-Control-Allow-Origin&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;*&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;s1&quot;&gt;&apos;Access-Control-Allow-Headers&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;origin,accept,content-type&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
        &lt;span class=&quot;nb&quot;&gt;json_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$resbody&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;JSON_UNESCAPED_UNICODE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;getObjectList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$credentials&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$accessKeyId&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$credentials&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;accessKeyId&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$accessKeySecret&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$credentials&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;accessKeySecret&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$securityToken&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$credentials&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;securityToken&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$endpoint&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;http://oss-cn-chengdu.aliyuncs.com&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$bucket&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;bucket&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ossClient&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;OssClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$accessKeyId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$accessKeySecret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$endpoint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$securityToken&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$options&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;delimiter&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;/&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;prefix&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;folder&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;max-keys&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;marker&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;nv&quot;&gt;$listObjectInfo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ossClient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;listObjects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$listObject&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$objectInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// TODO&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$listObject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>HTML基础大全</title>
   <link href="https://comeround.cn/article/html5-basic.html"/>
   <updated>2024-06-11T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/html5-basic</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;写代码的时间少、忘得快，因此把基础的内容做个笔记。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;1html5基础知识&quot;&gt;（1）HTML5基础知识&lt;/h2&gt;

&lt;p&gt;HTML5 引入了许多语义化标签来帮助开发者更好地描述页面结构。除了你提到的 article、main 和 aside 标签，还有以下一些重要的语义化标签：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;header - 用于定义一个页面或区域的头部。它可以包含导航链接、网站logo等。&lt;/li&gt;
  &lt;li&gt;nav - 用于定义页面的主要导航部分，通常包含指向其他页面或网站主要部分的链接。&lt;/li&gt;
  &lt;li&gt;section - 定义文档中的独立部分，如章节、页眉、页脚或文档中的其他独立部分。&lt;/li&gt;
  &lt;li&gt;footer - 定义页面或区域的底部，可以包含版权信息、联系方式等。&lt;/li&gt;
  &lt;li&gt;figure - 用于表示媒体内容（如图片、图表、视频等）和其标题的容器。常与 figcaption 标签一起使用。&lt;/li&gt;
  &lt;li&gt;figcaption - 用于为 figure 元素提供标题或说明。&lt;/li&gt;
  &lt;li&gt;time - 用于表示时间或日期，可以是具体的时间点，也可以是时间段。&lt;/li&gt;
  &lt;li&gt;mark - 用于高亮显示文本中的关键词或短语，以吸引读者注意。&lt;/li&gt;
  &lt;li&gt;details 和 summary - 这两个标签组合使用，可以创建可折叠的详细信息块。details 包含了详细信息，而 summary 则提供了可点击的标题行。&lt;/li&gt;
  &lt;li&gt;dialog - 用于表示对话框、提示框或模态窗口。它可以通过 JavaScript 控制显示和隐藏。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;这些标签不仅有助于提高代码的可读性和维护性，还能增强网页的可访问性和搜索引擎优化（SEO）。&lt;/p&gt;

&lt;h2 id=&quot;2css基础知识&quot;&gt;（2）CSS基础知识&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.arryblog.com/guide/css3/&quot;&gt;前端CSS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;css中声明变量&quot;&gt;CSS中声明变量&lt;/h5&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;:root&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;  
  &lt;span class=&quot;py&quot;&gt;--main-color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;#06c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  
  &lt;span class=&quot;py&quot;&gt;--padding-size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;10px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;  
  &lt;span class=&quot;nl&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;l&quot;&gt;--main-color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  
  &lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;l&quot;&gt;--padding-size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;一个弹出层的css样式&quot;&gt;一个弹出层的css样式&lt;/h5&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;#load-container&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;absolute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;100px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;z-index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;9999&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;3javascript基础知识&quot;&gt;（3）JAVASCRIPT基础知识&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;引入&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://xxxx.cn/jquery/3.6.1/jquery.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;js基础&quot;&gt;JS基础&lt;/h5&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;GetElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;classname&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 监听按键&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onkeydown&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;keyCode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;map&quot;&gt;map&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;map的使用&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;currentValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;thisArg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 全局格式&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;numbers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;doubledNumbers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;num&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;num&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;doubledNumbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// [2, 4, 6, 8, 10]&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;names&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Alice&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Bob&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Charlie&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;upperCaseNames&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;names&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;toUpperCase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;upperCaseNames&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// [&apos;ALICE&apos;, &apos;BOB&apos;, &apos;CHARLIE&apos;]&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;numbers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//y=x^2+3&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;module模块&quot;&gt;module模块&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;module制作&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// export 关键字导出模块的功能或数据&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;myFunction&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// 函数定义&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;myVariable&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;module引入&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;module&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;xxx.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;module&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;myFunction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;myVariable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;./myModule&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;myFunction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;js把字节转为对应字节单位&quot;&gt;Js把字节转为对应字节单位&lt;/h5&gt;
&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;formatSize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bytes&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;0 B&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;units&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;KB&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;MB&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;GB&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;TB&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;bytes&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;units&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;bytes&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;toFixed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;units&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 使用示例&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;byteSize&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1048576&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;formattedSize&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;formatSize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;byteSize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; 
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;formattedSize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;4jquery基础知识&quot;&gt;（4）JQUERY基础知识&lt;/h2&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;div.continue&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Next Step...&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 定义对象、操作对象&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;hiddenBox&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#banner-message&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#button-container button&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;hiddenBox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 请求后端数据&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ajax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/api/getWeather&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;zipcode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;97201&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;success&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#weather-temp&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;lt;strong&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;lt;/strong&amp;gt; degrees&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;/api/getWeather&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;zipcode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;97201&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;code&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>初中生物知识整理-七年级下</title>
   <link href="https://comeround.cn/article/chuzhong-sw-2.html"/>
   <updated>2024-06-05T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/chuzhong-sw-2</id>
   <content type="html">&lt;h2 id=&quot;初中七年级下册&quot;&gt;初中七年级下册&lt;/h2&gt;

&lt;h4 id=&quot;第一章--生殖系统&quot;&gt;第一章  生殖系统&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;人类和现代类人猿的共同祖先是（森林古猿）&lt;/li&gt;
  &lt;li&gt;人类进化的过程：原因（森林大量消失），下地生活→直立行走→制造并使用工具→产生语言&lt;/li&gt;
  &lt;li&gt;与人类亲缘关系最近的类人猿是（黑猩猩）
    &lt;h5 id=&quot;1男性生殖系统的结构和功能&quot;&gt;(1)男性生殖系统的结构和功能：&lt;/h5&gt;
  &lt;/li&gt;
  &lt;li&gt;睾丸：男性最主要的性器官，产生精子和分泌雄性激素&lt;/li&gt;
  &lt;li&gt;附睾：位于睾丸的背面，贮存和输送精子&lt;/li&gt;
  &lt;li&gt;输精管：输送精子
    &lt;h5 id=&quot;2女性生殖系统的结构和功能&quot;&gt;(2)女性生殖系统的结构和功能：&lt;/h5&gt;
  &lt;/li&gt;
  &lt;li&gt;卵巢：女性最主要的性器官，产生卵细胞和分泌雌性激素&lt;/li&gt;
  &lt;li&gt;输卵管：输送卵细胞，受精的场所&lt;/li&gt;
  &lt;li&gt;子宫：胚胎发育的场所&lt;/li&gt;
  &lt;li&gt;阴[敏感词分隔]道：月经流出，精子进入、胎儿产出的通道
(1)分娩：胎儿发育成熟后，从母体阴[敏感词分隔]道产出，这个过程叫做分娩。
(2)胚胎在子宫里的发育所需要的营养物资和氧通过胎盘、脐带从母体获得。
(3)在睾丸分泌的雄性激素和卵巢分泌的雌性激素的作用下，第二性征开始出现，男性的第二性征表现为（胡须、腋毛、喉结突出），女性的第二性征表现为骨盆宽大、乳房增大、声调高。（第二性征：除生殖器官外的其他变化）
男孩出现遗精，女孩出现月经是正常的生理现象。&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;第二章-消化系统&quot;&gt;第二章  消化系统&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;主要有六大类：糖类、脂肪、蛋白质、水、无机盐、维生素。&lt;/li&gt;
  &lt;li&gt;供能物质：糖类（主要能源物质）、脂肪（备用能源物质）、蛋白质（修复和更新细胞）&lt;/li&gt;
  &lt;li&gt;非供能物质：水、无机盐、维生素。&lt;/li&gt;
  &lt;li&gt;无机盐：钙：促进骨骼发育；铁：补血；碘：预防地方性甲状腺肿。&lt;/li&gt;
  &lt;li&gt;维生素的作用：
缺乏维生素A—-夜盲症、干眼症（和视觉有关）
缺乏维生素C—-坏血病，补新鲜蔬菜水果
缺乏维生素D—-佝偻病、骨质疏松症、侏儒症（和骨骼有关），补肝脏&lt;/li&gt;
  &lt;li&gt;“第七类营养素”—-膳食纤维：促进肠道的蠕动和排空。主要有芹菜&lt;/li&gt;
  &lt;li&gt;探究试验“馒头在口腔中的变化”：
淀粉在口腔中的消化与唾液的分泌、牙齿的咀嚼、舌的搅拌都有关系。
牙齿的切碎和磨碎以及舌的充分搅拌，能使唾液更加充分地与食物碎屑混合，更好地促进淀粉的变化。
淀粉是糖类，但没有甜味，淀粉在唾液淀粉酶的作用下分解成麦芽糖有甜味。
淀粉遇碘变蓝，麦芽糖遇碘不变蓝。
将馒头切碎是模拟牙齿的咀嚼，试管放进37℃温水中是模拟人体口腔温度，搅拌是模拟舌的搅拌功能。&lt;/li&gt;
  &lt;li&gt;消化道：口腔，咽，食道，胃，小肠，大肠，肛门&lt;/li&gt;
  &lt;li&gt;消化腺：
①唾液腺：分泌唾液（含有唾液淀粉酶），能初步消化淀粉
②肝脏：分泌胆汁（不含消化酶），将脂肪乳化为脂肪微粒，肝脏是人体最大的消化腺
③胰腺：分泌胰液（含有消化糖类、蛋白质和脂肪的酶）
④胃腺：分泌胃液（含有盐酸和胃蛋白酶），初步消化蛋白质 
⑤肠腺：分泌肠液（含有消化糖类、蛋白质和脂肪的酶）&lt;/li&gt;
  &lt;li&gt;小肠是消化食物和吸收营养物质的主要场所。 &lt;/li&gt;
  &lt;li&gt;小肠适于消化、吸收的特点：①很长，5-6米 ②皱襞和小肠绒毛
③丰富的毛细血管，只由一层上皮细胞构成 ④小肠内有各种消化液，多种消化酶。&lt;/li&gt;
  &lt;li&gt;食物的消化：(1)物理性消化：咀嚼、舌的搅拌、磨碎、搅拌(2)化学性消化：消化酶使食物分解。&lt;/li&gt;
  &lt;li&gt;淀粉→麦芽糖→葡萄糖；蛋白质→多肽→氨基酸；脂肪→脂肪微粒→甘油和脂肪酸&lt;/li&gt;
  &lt;li&gt;淀粉在口腔开始消化，蛋白质在胃中开始消化，脂肪在小肠开始消化。&lt;/li&gt;
  &lt;li&gt;营养物质的吸收：
小肠：吸收葡萄糖、氨基酸、甘油、脂肪酸、 大部分水、无机盐和维生素。
大肠：只吸收少量水、无机盐和一部分维生素。&lt;/li&gt;
  &lt;li&gt;平衡膳食宝塔：人每天摄入最多的应该是米、面等淀粉类主食，其次是蔬菜、水果，摄入量最少的是脂肪食品；&lt;/li&gt;
  &lt;li&gt;人在早、中、晚餐的能量摄取应当分别占30%、40%、30%。&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;第三章-人体的呼吸&quot;&gt;第三章 人体的呼吸&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;人体呼吸系统是由呼吸道和肺组成的。呼吸道由鼻、咽、喉、气管、支气管组成。&lt;/li&gt;
  &lt;li&gt;呼吸道的对空气的处理：温暖、湿润、清洁吸入的气体&lt;/li&gt;
  &lt;li&gt;咽是呼吸道和消化道的共同通路，即属于呼吸系统又属于消化系统。吞咽时，会厌软骨像盖子一样盖住喉口，以免食物进入气管，因此吃饭时不要大声说笑。&lt;/li&gt;
  &lt;li&gt;肺与外界的气体交换(胸骨、肋骨、胸椎围成胸廓，膈肌、肋间肌合称呼吸肌)&lt;/li&gt;
  &lt;li&gt;肺泡与血液的气体交换
①呼出的气体中氧气的含量减少，二氧化碳的含量增加。
②肺泡适于进行气体交换的特点：肺泡很多，肺泡外面包绕着丰富的毛细血管，肺泡壁和毛细血管壁薄很薄，都只由一层扁平的上皮细胞构成。&lt;/li&gt;
  &lt;li&gt;进入血液中的氧,通过血液循环输送到全身各处的组织细胞的线粒体里。&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;第四章人体内物质的运输&quot;&gt;第四章 人体内物质的运输&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;血液的组成和功能
血浆的成分：水(约占90%)、蛋白质、葡萄糖、无机盐等
功能：运载血细胞，运输养料和废物&lt;/li&gt;
  &lt;li&gt;血细胞：红细胞RBC，白细胞WBC，血小板 PLT
①红细胞：运输氧
②白细胞：防御和保护
③血小板：止血和凝血&lt;/li&gt;
  &lt;li&gt;血红蛋白：红细胞中含有的一种血红蛋白，因为血红蛋白中含铁，所以呈现出红色。
特性：在含氧高的地方与氧结合，在含氧低的地方与氧分离。&lt;/li&gt;
  &lt;li&gt;平原地区的运动员比赛前到高原地区集训，有利于人体血液中产生更多的红细胞。&lt;/li&gt;
  &lt;li&gt;血液属于结缔组织。&lt;/li&gt;
  &lt;li&gt;血管的种类、结构与功能
①动脉：管壁厚、弹性大、血流速度快
②静脉：管壁薄、弹性销、血流速度慢，四肢静脉内有静脉瓣
③毛细血管：管壁非常薄、由一层上皮细胞构成，只允许红细胞单行通过，血流速度最慢&lt;/li&gt;
  &lt;li&gt;中医“把脉”用的是手腕处的桡动脉。静脉俗称“青筋”，抽血、输血、打点滴（静脉注射）用的是静脉。&lt;/li&gt;
  &lt;li&gt;毛细血管管壁非常薄，只有一层上皮细胞构成，管内血流速度最慢，这些特点有利于血液与组织细胞进行物质交换。&lt;/li&gt;
  &lt;li&gt;心脏的结构和功能：
有四个腔：上房下室，左右相隔；房连静，室连动
左心室（主动脉）    左心房（肺静脉）
右心室（肺动脉）    右心房（上、下腔静脉）
★记忆指导：上房下室、房静室动、左主右肺、上下相通，左右不通&lt;/li&gt;
  &lt;li&gt;瓣膜（房室瓣、动脉瓣）：保证了血液按一定的方向流动，防止血液倒流。&lt;/li&gt;
  &lt;li&gt;血液循环：分为体循环和肺循环
体循环：左心室→主动脉→各级动脉→身体各处毛细血管→各级静脉→上下腔静脉→右心房
肺循环：右心室→肺动脉→肺部毛细血管→肺静脉→左心房&lt;/li&gt;
  &lt;li&gt;两条血液循环途径共同点（血液流动方向）：心室→动脉→毛细血管网→静脉→另一侧心房&lt;/li&gt;
  &lt;li&gt;动脉血（含氧丰富、颜色鲜红）；静脉血（含氧较少、颜色暗红）。&lt;/li&gt;
  &lt;li&gt;血量：占体重的7%-8%。
①少量失血（不超过400ml），所丧失的血浆成分和血细胞可以在短时间内得到补充而恢复正常
②失血超过800-1000ml，会出现头晕、心跳、眼前发黑和出冷汗等症状
③一次失血超过1200-1500ml会发生生命危险，需及时输血。&lt;/li&gt;
  &lt;li&gt;ABO血型：A型、B型、AB型、O型。&lt;/li&gt;
  &lt;li&gt;输血：以输同型血为原则。紧急情况下都可以输入少量O型血。&lt;/li&gt;
  &lt;li&gt;倡导无偿献血：每次献血200-300ml血液不会影响健康。&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;第五章-人体内废物的排出&quot;&gt;第五章  人体内废物的排出&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;排泄途径：
①皮肤：以汗液的形式排出水、无机盐、尿素等。
②呼吸系统：以气体的形式排出二氧化碳、水等。
③泌尿系统：以尿液的形式排出水、无机盐、尿素等。&lt;/li&gt;
  &lt;li&gt;排遗：食物消化后的残渣形成的粪便排出体外的过程。&lt;/li&gt;
  &lt;li&gt;泌尿系统的组成
①肾脏：形成尿的场所 ②输尿管：输送尿液 ③膀胱：暂时贮存尿液 ④尿道：排出尿液&lt;/li&gt;
  &lt;li&gt;每个肾脏由100多万个肾单位构成，肾单位是形成尿液的基本单位。&lt;/li&gt;
  &lt;li&gt;每个肾单位由肾小球、肾小囊、肾小管组成。肾小球内流动脉血，肾小囊起过滤作用&lt;/li&gt;
  &lt;li&gt;尿的形成
(1)肾小球、肾小囊壁的过滤作用：肾小球和肾小囊壁过滤血液，除了血细胞和大分子的蛋白质以外的血浆成分都可以过滤，在肾小囊中形成原尿。
(2)肾小管的重吸收作用：对人体有用的物质，包括大部分水、全部葡萄糖和部分无机盐被重吸收进入包围在肾小管外面的毛细血管中（进入血液循环），剩下的形成尿液。
(3)尿路和血路：
血路：肾动脉→入球小动脉（动脉血）→肾小球毛细血管（动脉血）→出球小动脉（动脉血）→肾小管外毛细血管（动脉血静脉血）→肾静脉（静脉血）
尿路：肾小囊（原尿）→肾小管（重吸收）→收集管→输尿管→膀胱→尿道&lt;/li&gt;
  &lt;li&gt;尿的排出：肾脏→输尿管→膀胱→尿道&lt;/li&gt;
  &lt;li&gt;排尿的意义：
(1)排出代谢废物。(2)调节体内水和无机盐的平衡，维持组织细胞的正常生理功能。(3)调节体温。&lt;/li&gt;
  &lt;li&gt;经皮肤排泄：汗腺（外分泌腺，有导管）分泌汗液，主要成分水，还有少量尿素和无机盐等，汗液蒸发能带走一部分热量，因此汗腺还有调节体温的作用。
*区别：
血液（包括血细胞和血浆）。
血浆（含有各种营养成分和代谢废物）。
原尿（没有血细胞，不含大分子蛋白质，含有大量的水，无机盐、尿素、葡萄糖等）
尿液（没有血细胞，不含蛋白质、葡萄糖，主要是水、无机盐、尿素等）&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;第六章-人体生命活动的调节&quot;&gt;第六章  人体生命活动的调节&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;眼球的结构与功能：
①巩膜：眼球白色部位，保护眼球内部的作用
②虹膜：有色素（决定人眼的颜色，黑色、褐色、蓝色等），中央的小孔是瞳孔
③瞳孔：光线进入的通道，大小可以调节。亮光时瞳孔缩小，暗光时瞳孔扩大。
④视网膜：上有大量感光细胞，能感受光的刺激，形成物像。
⑤晶状体：双凸透镜，曲度可以调节，折射光线，使眼睛看清远近不同的物体&lt;/li&gt;
  &lt;li&gt;视觉的形成：
(1)成像：在视网膜中形成物像。
(2)形成视觉：外界光线→在视网膜上成像，感光细胞产生兴奋，产生神经冲动→视觉神经→大脑皮层的视觉中枢，形成视觉。视觉最终在大脑皮层视觉中枢形成。&lt;/li&gt;
  &lt;li&gt;眼的卫生保健：①近视：戴凹透镜矫正 ②远视：戴凸透镜矫正 ③保护视力，预防近视，应该做到“三要”“四不要”&lt;/li&gt;
  &lt;li&gt;耳的结构和功能
①鼓膜：接受声波，产生震动。
②耳蜗：内有听觉感受器，能把振动转变成相关的神经冲动。&lt;/li&gt;
  &lt;li&gt;听觉形成的部位是大脑皮层听觉中枢。&lt;/li&gt;
  &lt;li&gt;遇到巨大声响时：要迅速张口，使咽鼓管张开；或闭嘴，同时双手堵耳，使鼓膜内外的气压保持平衡，以免震破鼓膜。&lt;/li&gt;
  &lt;li&gt;神经系统是由脑、脊髓和它们发出的神经组成。&lt;/li&gt;
  &lt;li&gt;神经系统的组成：中枢神经系统（脑和脊髓）、周围神经系统（脑神经、脊神经）。&lt;/li&gt;
  &lt;li&gt;中枢神经系统：
大脑（表面是大脑皮层，调节人体生理活动的最高级中枢）、小脑（运动协调、维持身体平衡）、脑干（调节心跳、呼吸、血压）。
脊髓：是脑与躯干、内脏之间的联系通道。&lt;/li&gt;
  &lt;li&gt;神经元是神经系统的结构和功能的基本单位，基本结构包括细胞体和突起。
功能：感受刺激、产生并传导兴奋。&lt;/li&gt;
  &lt;li&gt;反射是神经调节的基本方式。
反射的概念：动物（包括人）通过神经系统，对外界或内部的各种刺激所产生的有规律的反应。&lt;/li&gt;
  &lt;li&gt;反射的结构基础——反射弧
组成：感受器→传入神经→神经中枢→传出神经→效应器&lt;/li&gt;
  &lt;li&gt;膝跳反射扣击部位：膝盖下位的韧带。
现象：小腿以膝盖为轴，突然弹跳起来，不受大脑控制。
缩手反射时先缩手，后感觉疼痛或烫。缩手的神经中枢在脊髓；感觉（疼、烫）的神经中枢在大脑皮层。&lt;/li&gt;
  &lt;li&gt;反射的类型
简单的反射：神经中枢位于脊髓内
复杂的反射：神经中枢位于大脑皮层内&lt;/li&gt;
  &lt;li&gt;人体主要内分泌腺：
①垂体：分泌生长激素等，作用：调节人体的生长发育（不足：侏儒症，过多：巨人症/肢端肥大症）
②甲状腺：分泌甲状腺激素，促进生长发育、新陈代谢、神经系统兴奋（不足：呆小症；过多：甲亢；缺碘：甲状腺肿）
③胰岛：位于胰腺中，分泌胰岛素（缺乏：糖尿病；过多：低血糖）
④肾上腺：分泌肾上腺激素，情绪激动时分泌明显增多。
⑤胸腺：分泌胸腺激素。
⑥性腺：睾丸（男性）：分泌雄性激素。 卵巢（女性）：分泌雌性激素。&lt;/li&gt;
  &lt;li&gt;激素：由内分泌腺的腺细胞所分泌的、对身体有特殊作用的化学物质。&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;第七章-人类对环境的影响&quot;&gt;第七章 人类对环境的影响&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;汞、镉&lt;/li&gt;
  &lt;li&gt;温室效应&lt;/li&gt;
  &lt;li&gt;酸雨的形成&lt;/li&gt;
&lt;/ol&gt;
</content>
 </entry>
 
 <entry>
   <title>ECharts学习绘图1</title>
   <link href="https://comeround.cn/article/echarts-demo.html"/>
   <updated>2023-12-07T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/echarts-demo</id>
   <content type="html">&lt;style&gt;
.article-div{
  height:400px;
}
@media screen and (min-width: 300px) {
  .article-div{
    width: 95%;
    margin: 0 auto;
  }
}
@media screen and (min-width: 600px) {
  .article-div{
    width: 80%;
    margin: 20px auto;
  }
}
@media screen and (min-width: 1000px) {
  .article-div{
    width: 60%;
    margin: 20px auto;
  }
}
    &lt;/style&gt;

&lt;div id=&quot;main1&quot; class=&quot;article-div&quot;&gt;&lt;/div&gt;
&lt;hr /&gt;

&lt;div id=&quot;main2&quot; class=&quot;article-div&quot;&gt;&lt;/div&gt;
&lt;hr /&gt;

&lt;div id=&quot;main3&quot; class=&quot;article-div&quot;&gt;&lt;/div&gt;
&lt;hr /&gt;

&lt;div id=&quot;main4&quot; class=&quot;article-div&quot;&gt;&lt;/div&gt;
&lt;hr /&gt;

&lt;div id=&quot;main5&quot; class=&quot;article-div&quot;&gt;&lt;/div&gt;
&lt;hr /&gt;

&lt;div id=&quot;main6&quot; class=&quot;article-div&quot;&gt;&lt;/div&gt;
&lt;hr /&gt;

&lt;div id=&quot;main7&quot; class=&quot;article-div&quot;&gt;&lt;/div&gt;
&lt;hr /&gt;

&lt;script src=&quot;//mirror.fe80.cn/echarts/5.4.3/echarts.min.js&quot;&gt;&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
/*
// +------------------------------------------------
// | 第一个图： 柱状图和线性图
// +------------------------------------------------
*/
var myChart1 = echarts.init(document.getElementById(&apos;main1&apos;));

var option1 = {
    title: {
        text: &apos;柱状图比例&apos;
    },
    tooltip: {},
    legend: {
        data: [&apos;平江村&apos;, &apos;亮司村&apos;, &apos;龙池村&apos;, &apos;雷屯村&apos;],
        backgroundColor: &apos;#fff&apos;,
        textStyle: {
        color: &apos;#222&apos;
        }
    },
    xAxis: {
        type: &apos;category&apos;,
        data: [&apos;2021&apos;, &apos;2022&apos;, &apos;2023&apos;, &apos;2024&apos;]
    },
    yAxis: {},
    series: [
        {
            type: &apos;bar&apos;,
            name: &apos;平江村&apos;,
            data: [89.3, 92.1, 94.4, 85.4],
            itemStyle: {
                borderColor: &apos;rgb(255, 99, 132)&apos;,
                color: &apos;rgba(255, 99, 132, 0.2)&apos;
            }
        },
        {
            type: &apos;bar&apos;,
            name: &apos;亮司村&apos;,
            data: [95.8, 89.4, 91.2, 76.9],
            itemStyle: {
                borderColor: &apos;rgb(255, 159, 64)&apos;,
                color: &apos;rgba(255, 159, 64, 0.2)&apos;
            }
        },
        {
            type: &apos;bar&apos;,
            name: &apos;龙池村&apos;,
            data: [97.7, 83.1, 92.5, 78.1],
            itemStyle: {
                borderColor: &apos;rgb(75, 192, 192)&apos;,
                color: &apos;rgba(75, 192, 192, 0.2)&apos;
            }
        },
        {
            type: &apos;line&apos;,
            name: &apos;雷屯村&apos;,
            data: [92.7, 73.1, 62.5, 83.1],
            itemStyle: {
                borderColor: &apos;rgb(153, 102, 255)&apos;,
                color: &apos;rgba(153, 102, 255, 0.9)&apos;
            }
        }
    ]
};
myChart1.setOption(option1);

/*
// +------------------------------------------------
// | 第二个图： 堆叠柱状图
// +------------------------------------------------
*/
var myChart2 = echarts.init(document.getElementById(&apos;main2&apos;));

var option2 = {
    title: {
        text: &apos;堆叠柱状图&apos;
    },
    tooltip: {},
    legend: {
        data: [&apos;敦寨村&apos;, &apos;平江村&apos;, &apos;亮司村&apos;, &apos;龙池村&apos;, &apos;雷屯村&apos;],
        backgroundColor: &apos;#fff&apos;,
        textStyle: {
            color: &apos;#222&apos;
        }
    },
    xAxis: {
        data: [&apos;敦寨村&apos;, &apos;平江村&apos;, &apos;亮司村&apos;, &apos;龙池村&apos;, &apos;雷屯村&apos;],
    },
    yAxis: {},
    series: [
        {
            data: [10, 22, 28, 43, 49],
            type: &apos;bar&apos;,
            stack: &apos;x&apos;
        },{
            data: [5, 4, 3, 5, 10],
            type: &apos;bar&apos;,
            stack: &apos;x&apos;
        }
    ]
};
myChart2.setOption(option2);
/*
// +------------------------------------------------
// | 第三个图： 动态排序柱状图
// +------------------------------------------------
*/
var myChart3 = echarts.init(document.getElementById(&apos;main3&apos;));

var data = [];
for (let i = 0; i &lt; 5; ++i) {
    data.push(Math.round(Math.random() * 200));
}

option3 = {
    title: {
        text: &apos;动态排序柱状图&apos;
    },
    xAxis: {
        max: &apos;dataMax&apos;
    },
    yAxis: {
        type: &apos;category&apos;,
        data: [&apos;敦寨村&apos;, &apos;平江村&apos;, &apos;亮司村&apos;, &apos;龙池村&apos;, &apos;雷屯村&apos;],
        inverse: true,
        animationDuration: 300,
        animationDurationUpdate: 300,
        max: 2
    },
    series: [
        {
            realtimeSort: true,
            name: &apos;旅游人次&apos;,
            type: &apos;bar&apos;,
            data: data,
            label: {
                show: true,
                position: &apos;right&apos;,
                valueAnimation: true
            },
            itemStyle: {
                borderColor: &apos;rgb(255, 159, 64)&apos;,
                color: &apos;rgba(255, 159, 64, 0.2)&apos;
            }
        }
    ],
    legend: {
        show: true
    },
    animationDuration: 3000,
    animationDurationUpdate: 3000,
    animationEasing: &apos;linear&apos;,
    animationEasingUpdate: &apos;linear&apos;
};

function update() {
    var data = option3.series[0].data;
    for (var i = 0; i &lt; data.length; ++i) {
        if (Math.random() &gt; 0.9) {
            data[i] += Math.round(Math.random() * 2000);
        } else {
            data[i] += Math.round(Math.random() * 200);
        }
    }
    myChart3.setOption(option3);
}
update();
setInterval(function() {
    update();
}, 3000);

/*
// +------------------------------------------------
// | 第四个图： 堆叠柱状图
// +------------------------------------------------
*/
var myChart4 = echarts.init(document.getElementById(&apos;main4&apos;));

var option4 = {
  title: {
    text: &apos;敦寨镇旅游人数&apos;,
    left: &apos;center&apos;,
    top: &apos;center&apos;
  },
    tooltip: {},
  series: [
    {
      type: &apos;pie&apos;,
      data: [
        {
          value: 335,
          name: &apos;雷屯村&apos;,
            itemStyle: {
                color: &apos;rgba(255, 126, 122, 0.8)&apos;
            }
        },
        {
          value: 234,
          name: &apos;龙池村&apos;,
            itemStyle: {
                color: &apos;rgba(255, 159, 64, 0.8)&apos;
            }
        },
        {
          value: 1548,
          name: &apos;亮司村&apos;,
            itemStyle: {
                color: &apos;rgba(75, 192, 192, 0.8)&apos;
            }
        },
        {
          value: 754,
          name: &apos;平江村&apos;,
            itemStyle: {
                color: &apos;rgba(0, 133, 255, 0.8)&apos;
            }
        }
      ],
      radius: [&apos;40%&apos;, &apos;70%&apos;]
    }
  ]
};
myChart4.setOption(option4);
/*
// +------------------------------------------------
// | 第五个图： 圆角环形图
// +------------------------------------------------
*/
var myChart5 = echarts.init(document.getElementById(&apos;main5&apos;));
var option5 = {
  tooltip: {
    trigger: &apos;item&apos;
  },
  legend: {
    top: &apos;5%&apos;,
    left: &apos;center&apos;
  },
  tooltip: {},
  series: [
    {
      name: &apos;敦寨镇旅游人次&apos;,
      type: &apos;pie&apos;,
      radius: [&apos;40%&apos;, &apos;70%&apos;],
      avoidLabelOverlap: false,
      itemStyle: {
        borderRadius: 10,
        borderColor: &apos;#fff&apos;,
        borderWidth: 2
      },
      label: {
        show: false,
        position: &apos;center&apos;
      },
      emphasis: {
        label: {
          show: true,
          fontSize: 40,
          fontWeight: &apos;bold&apos;
        }
      },
      labelLine: {
        show: false
      },
      data: [
        { value: 1048, name: &apos;雷屯村&apos; },
        { value: 735, name: &apos;龙池村&apos; },
        { value: 580, name: &apos;亮司村&apos; },
        { value: 484, name: &apos;平江村&apos; },
        { value: 300, name: &apos;笋屯村&apos; }
      ]
    }
  ]
};
myChart5.setOption(option5);

/*
// +------------------------------------------------
// | 第六个图： 圆角环形图
// +------------------------------------------------
*/
var myChart6 = echarts.init(document.getElementById(&apos;main6&apos;));
var option6 = {
  tooltip: {
    formatter: &apos;{a} &lt;br/&gt;{b} : {c}%&apos;
  },
  series: [
    {
      name: &apos;基础仪表盘&apos;,
      type: &apos;gauge&apos;,
      progress: {
        show: true
      },
      detail: {
        valueAnimation: true,
        formatter: &apos;{value}&apos;
      },
      data: [
        {
          value: 39,
          name: &apos;完成情况&apos;,
            itemStyle: {
                borderColor: &apos;rgb(255, 126, 122)&apos;,
                color: &apos;rgba(255, 126, 122, 0.9)&apos;
            }
        }
      ]
    }
  ]
};
myChart6.setOption(option6);
/*
// +------------------------------------------------
// | 第七个图： 指定数据到坐标轴
// +------------------------------------------------
*/
var myChart7 = echarts.init(document.getElementById(&apos;main7&apos;));
var option7 = {
  title: {
    text: &apos;指定数据到坐标轴&apos;,
  },
  dataset: {
    source: [
      [&apos;score&apos;, &apos;amount&apos;, &apos;product&apos;],
      [89.3, 58212, &apos;七(1)班&apos;],
      [57.1, 78254, &apos;七(2)班&apos;],
      [74.4, 41032, &apos;七(3)班&apos;],
      [50.1, 12755, &apos;七(4)班&apos;],
      [89.7, 20145, &apos;七(5)班&apos;],
      [68.1, 79146, &apos;七(6)班&apos;],
      [19.6, 91852, &apos;七(7)班&apos;],
      [10.6, 101852, &apos;七(8)班&apos;],
      [32.7, 20112, &apos;七(9)班&apos;]
    ]
  },
  grid: { containLabel: true },
  xAxis: { name: &apos;amount&apos; },
  yAxis: { type: &apos;category&apos; },
  visualMap: {
    orient: &apos;horizontal&apos;,
    left: &apos;center&apos;,
    min: 10,
    max: 100,
    text: [&apos;高分&apos;, &apos;低分&apos;],
    dimension: 0,
    inRange: {
      color: [&apos;#65B581&apos;, &apos;#FFCE34&apos;, &apos;#FD665F&apos;]
    }
  },
  series: [
    {
      type: &apos;bar&apos;,
      encode: {
        /* Map the &quot;amount&quot; column to X axis. */
        x: &apos;amount&apos;,
        /* Map the &quot;product&quot; column to Y axis */
        y: &apos;product&apos;
      }
    }
  ]
};
myChart7.setOption(option7);
&lt;/script&gt;

&lt;blockquote&gt;
  &lt;p&gt;学习笔记&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://echarts.apache.org/examples/zh/index.html&quot;&gt;echarts示例&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://echarts.apache.org/handbook/zh/get-started&quot;&gt;echarts文档&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>ChartJs数据图表可视化</title>
   <link href="https://comeround.cn/article/chart-js.html"/>
   <updated>2023-12-05T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/chart-js</id>
   <content type="html">&lt;h2 id=&quot;一柱状图&quot;&gt;一、柱状图&lt;/h2&gt;

&lt;div class=&quot;x-container&quot;&gt;
    &lt;h3&gt;（1）折线图&lt;/h3&gt;
    &lt;p style=&quot;text-indent: 2em;color: #666;&quot;&gt;环形图又叫做甜甜圈图，其本质是饼图将中间区域挖空。&lt;/p&gt;
    &lt;div style=&quot;width: 500px;height: 275px; margin: 2px auto;&quot;&gt;
        &lt;canvas id=&quot;myChart&quot;&gt;&lt;/canvas&gt;
    &lt;/div&gt;
    &lt;h3&gt;（2）柱状图&lt;/h3&gt;
    &lt;p style=&quot;text-indent: 2em;color: #666;&quot;&gt;环形图又叫做甜甜圈图，其本质是饼图将中间区域挖空。&lt;/p&gt;
    &lt;div style=&quot;width: 500px;height: 275px; margin: 2px auto;&quot;&gt;
        &lt;canvas id=&quot;myChart2&quot;&gt;&lt;/canvas&gt;
    &lt;/div&gt;
    &lt;h3&gt;（3）比例图&lt;/h3&gt;
    &lt;p style=&quot;text-indent: 2em;color: #666;&quot;&gt;环形图又叫做甜甜圈图，其本质是饼图将中间区域挖空。
        环形图是由两个及两个以上大小不一的饼图叠在一起，挖去中间的部分所构成的图形。          
        饼图是用圆形及圆内扇形的角度来表示数值大小的图形，它主要用于表示一个样本（或总体）中各组成部分的数据占全部数据的比例，对于研究结构性问题十分有用。
    &lt;/p&gt;
    &lt;div style=&quot;width: 500px;height: 500px; margin: 2px auto;&quot;&gt;
        &lt;canvas id=&quot;myChart3&quot;&gt;&lt;/canvas&gt;
    &lt;/div&gt;
    &lt;h3&gt;（4）混合图&lt;/h3&gt;
    &lt;p style=&quot;text-indent: 2em;color: #666;&quot;&gt;
        环形图又叫做甜甜圈图，其本质是饼图将中间区域挖空。
        环形图是由两个及两个以上大小不一的饼图叠在一起，挖去中间的部分所构成的图形。
        饼图是用圆形及圆内扇形的角度来表示数值大小的图形，它主要用于表示一个样本（或总体）中各组成部分的数据占全部数据的比例，对于研究结构性问题十分有用。
    &lt;/p&gt;
    &lt;div style=&quot;width: 500px;height: 275px; margin: 2px auto;&quot;&gt;
        &lt;canvas id=&quot;myChart4&quot;&gt;&lt;/canvas&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;style&gt;
.x-container{
  width: 96%;
  margin: 0 auto;
}
&lt;/style&gt;

&lt;script src=&quot;//mirror.fe80.cn/Chart.js/3.9.1/chart.min.js&quot;&gt;&lt;/script&gt;

&lt;script&gt;
var ctx = document.getElementById(&apos;myChart&apos;);
var labels = [&apos;一月份&apos;, &apos;二月份&apos;, &apos;三月份&apos;,&apos;四月份&apos;, &apos;五月份&apos;, &apos;六月份&apos;, &apos;七月份&apos;];
var data = {
  labels: labels,
  datasets: [{
    label: &apos;语文&apos;,
    data: [65, 59, 80, 81, 56, 55, 40],
    fill: false,
    borderColor: &apos;rgb(75, 192, 192)&apos;,
    tension: 0.1
  },{
    label: &apos;数学&apos;,
    data: [55, 69, 70, 81, 46, 45, 30],
    fill: false,
    borderColor: &apos;rgb(175, 92, 192)&apos;,
    tension: 0.1
  }]
};
var config = {
  type: &apos;line&apos;,
  data: data,
};
var myChart = new Chart(ctx, config);
var ctx2 = document.getElementById(&apos;myChart2&apos;);
var labels2 = [&apos;一月份&apos;, &apos;二月份&apos;, &apos;三月份&apos;,&apos;四月份&apos;, &apos;五月份&apos;, &apos;六月份&apos;, &apos;七月份&apos;];
var data2 = {
  labels: labels2,
  datasets: [{
    label: &apos;七年级&apos;,
    data: [65, 59, 80, 81, 56, 55, 40],
    backgroundColor: [
      &apos;rgba(255, 99, 132, 0.2)&apos;,
      &apos;rgba(255, 159, 64, 0.2)&apos;,
      &apos;rgba(255, 205, 86, 0.2)&apos;,
      &apos;rgba(75, 192, 192, 0.2)&apos;,
      &apos;rgba(54, 162, 235, 0.2)&apos;,
      &apos;rgba(153, 102, 255, 0.2)&apos;,
      &apos;rgba(201, 203, 207, 0.2)&apos;
    ],
    borderColor: [
      &apos;rgb(255, 99, 132)&apos;,
      &apos;rgb(255, 159, 64)&apos;,
      &apos;rgb(255, 205, 86)&apos;,
      &apos;rgb(75, 192, 192)&apos;,
      &apos;rgb(54, 162, 235)&apos;,
      &apos;rgb(153, 102, 255)&apos;,
      &apos;rgb(201, 203, 207)&apos;
    ],
    borderWidth: 1
  },{
    label: &apos;八年级&apos;,
    data: [5, -10, -12, -15, 6, -18, 3],
    backgroundColor: [
      &apos;rgba(255, 99, 132, 0.2)&apos;,
      &apos;rgba(255, 159, 64, 0.2)&apos;,
      &apos;rgba(255, 205, 86, 0.2)&apos;,
      &apos;rgba(75, 192, 192, 0.2)&apos;,
      &apos;rgba(54, 162, 235, 0.2)&apos;,
      &apos;rgba(153, 102, 255, 0.2)&apos;,
      &apos;rgba(201, 203, 207, 0.2)&apos;
    ],
    borderColor: [
      &apos;rgb(255, 99, 132)&apos;,
      &apos;rgb(255, 159, 64)&apos;,
      &apos;rgb(255, 205, 86)&apos;,
      &apos;rgb(75, 192, 192)&apos;,
      &apos;rgb(54, 162, 235)&apos;,
      &apos;rgb(153, 102, 255)&apos;,
      &apos;rgb(201, 203, 207)&apos;
    ],
    borderWidth: 1
  }]
};
var config2 = {
  type: &apos;bar&apos;,
  data: data2,
  options: {
    scales: {
      y: {
        beginAtZero: true
      }
    }
  },
};
var myChart2 = new Chart(ctx2, config2);
var ctx3 = document.getElementById(&apos;myChart3&apos;);
var data3 = {
  labels: [
    &apos;七年级&apos;,
    &apos;八年级&apos;,
    &apos;九年级&apos;
  ],
  datasets: [{
    label: &apos;环形图实例&apos;,
    data: [60, 50, 30],
    backgroundColor: [
      &apos;rgb(255, 99, 132)&apos;,
      &apos;rgb(54, 162, 235)&apos;,
      &apos;rgb(255, 205, 86)&apos;
    ],
    hoverOffset: 4
  }]
};
var config3 = {
  type: &apos;doughnut&apos;,
  data: data3,
  options: {
    responsive: true,
    maintainAspectRatio: false,
    scales: {
    }
  }
};
var myChart3 = new Chart(ctx3, config3);
var ctx4 = document.getElementById(&apos;myChart4&apos;);
var data4 = {
  labels: [
    &apos;一月份&apos;,
    &apos;二月份&apos;,
    &apos;三月份&apos;,
    &apos;四月份&apos;
  ],
  datasets: [{
    type: &apos;bar&apos;,
    label: &apos;柱形图数据集&apos;,
    data: [45, 49, 52, 48],
    borderColor: &apos;rgb(255, 99, 132)&apos;,
    backgroundColor: &apos;rgba(255, 99, 132, 0.2)&apos;
  }, {
    type: &apos;line&apos;,
    label: &apos;折线图数据集&apos;,
    data: [50, 30, 25, 49],
    fill: false,
    borderColor: &apos;rgb(54, 162, 235)&apos;
  }]
};
var config4 = {
  type: &apos;scatter&apos;,
  data: data4,
  options: {
    responsive: true,
    maintainAspectRatio: false,
    scales: {
      y: {
        beginAtZero: true
      }
    }
  }
};
var myChart4 = new Chart(ctx4, config4);
&lt;/script&gt;

</content>
 </entry>
 
 <entry>
   <title>初中生物知识整理-七年级上</title>
   <link href="https://comeround.cn/article/chuzhong-sw-1.html"/>
   <updated>2023-10-31T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/chuzhong-sw-1</id>
   <content type="html">&lt;h2 id=&quot;初中全程总复习生物知识要点&quot;&gt;初中全程总复习生物知识要点&lt;/h2&gt;

&lt;p&gt;【初中生物】七年级上册必背知识点&lt;/p&gt;
&lt;h3 id=&quot;第一单元-第一部分生物和生物圈&quot;&gt;第一单元 第一部分生物和生物圈&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;生物的特征：1.生物的生活需要营养；2.生物能进行呼吸；3.生物能排出体内产生的废物；4.生物能对外界刺激做出反应；5.生物能生长和繁殖；6.生物都有遗传和变异的特性；7.除病毒以外，生物都是由细胞构成。&lt;/li&gt;
  &lt;li&gt;珊瑚、钟乳石、机器人不是生物，珊瑚虫、生石花是生物。&lt;/li&gt;
  &lt;li&gt;食物链：在生态系统中，不同生物之间由于吃与被吃的关系而形成的链状结构叫做食物链。食物链的起始环节是生产者，必须包含（生产者）和（消费者），不能有（分解者）。在食物链传递过程中营养等级越高，有毒物质积累得就越多。&lt;/li&gt;
  &lt;li&gt;生态系统的能量最终来源于（太阳能）。&lt;/li&gt;
  &lt;li&gt;生物与生物之间最常见的关系是捕食关系、竞争关系、合作关系、寄生关系等&lt;/li&gt;
  &lt;li&gt;（生物圈）是最大的生态系统：生物圈的范围包括大气圈的底部（生活着鸟类、昆虫、细菌等）、水圈的大部（大多数生物生活在距海平面150米内的水层中）、岩石圈的表面（是一切陆生生物的“立足点”）。&lt;/li&gt;
  &lt;li&gt;湿地生态系统→地球之肾；森林生态系统→绿色水库和地球之肺。&lt;/li&gt;
  &lt;li&gt;生态系统包括生物部分和非生物部分，生物部分：植物→生产者、动物→消费者、细菌真菌→分解者；非生物部分：阳光/水/空气/土壤。&lt;/li&gt;
  &lt;li&gt;生态系统具有一定的自动调节能力，但这种能力是有一定限度的。&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;第二单元&quot;&gt;第二单元&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;（低倍镜）看到的细胞多；（高倍镜）看到的细胞更加清晰。（高倍镜、低倍镜）&lt;/li&gt;
  &lt;li&gt;调节显微镜亮度的结构是（遮光器）和（反光镜）；凹面镜比平面镜更亮。&lt;/li&gt;
  &lt;li&gt;为使模糊图像更加清晰应使用（细准焦螺旋）。（粗准焦螺旋、细准焦螺旋）&lt;/li&gt;
  &lt;li&gt;植物细胞比动物细胞多的细胞器是（细胞壁）、（叶绿体）、（液泡）。&lt;/li&gt;
  &lt;li&gt;细胞核、细胞质、液泡、叶绿体、线粒体、细胞膜、细胞壁的功能分别是（遗传物质、新陈代谢、细胞液、光合作用、能量、控制物质进出、保护和支持）。&lt;/li&gt;
  &lt;li&gt;能量转换器指的是（叶绿体）和（线粒体），叶绿体能使（光）能转换成（化学）能，线粒体将（化学能）转变为细胞利用的能量，即（释放能量）。&lt;/li&gt;
  &lt;li&gt;菠萝汁、水果汁主要存在于细胞的（液泡）；洋葱刺激性气味主要来源于（液泡）；花瓣颜色、洋葱鳞片表皮颜色主要存在于（液泡）；花瓣没有（叶绿体）；绿叶颜色主要存在于（叶绿体）。
（细胞核、细胞质、液泡、叶绿体、线粒体）&lt;/li&gt;
  &lt;li&gt;制作口腔上皮细胞临时装片使用生理盐水。染色剂使用（稀碘液）。操作步骤（刮/涂）
制作洋葱鳞片叶内表皮细胞临时装片滴清水。染色剂是碘液。&lt;/li&gt;
  &lt;li&gt;有机物有（蛋白质、淀粉、糖类、脂质）；无机物有（水、无机盐、空气、二氧化碳）&lt;/li&gt;
  &lt;li&gt;细胞的生长、细胞的分裂、细胞的分化的过程和区别是（由小变大、数目增多、种类增加）&lt;/li&gt;
  &lt;li&gt;细胞分裂的顺序是（核质膜壁）；细胞分裂过程中染色体的变化是（先复制再均分）&lt;/li&gt;
  &lt;li&gt;细胞分裂过程中染色体变化最为明显。&lt;/li&gt;
  &lt;li&gt;染色体主要由（DNA和蛋白质）构成。染色体存在于细胞的（细胞核）&lt;/li&gt;
  &lt;li&gt;DNA、染色体、蛋白质、细胞核的关系：DNA→染色体→细胞核→细胞&lt;/li&gt;
  &lt;li&gt;人体的基本组织有哪四个？上皮组织（保护）、肌肉组织（收缩和舒张）、神经组织（传导神经冲动/脊髓和大脑）、结缔组织（连接、营养/血液）。&lt;/li&gt;
  &lt;li&gt;人的生命始于一个细胞，这个细胞叫做（受精卵）。&lt;/li&gt;
  &lt;li&gt;（细胞）是构成生物体的基本单位。&lt;/li&gt;
  &lt;li&gt;皮肤是器官。&lt;/li&gt;
  &lt;li&gt;动物体结构层次比植物结构层次多的是（系统）&lt;/li&gt;
  &lt;li&gt;简述动物体的结构层次（细胞→组织→器官→系统→动物体）&lt;/li&gt;
  &lt;li&gt;简述植物体的结构层次（细胞→组织→器官→植物体）。
植物体的几种主要组织和功能（保护组织、营养组织/营养、输导组织/筋络和导管、机械组织）。
植物体的六大器官和分类（营养器官：根/茎/叶、生殖器官：花/果实/种子）。&lt;/li&gt;
  &lt;li&gt;根尖、嫩芽主要是（分生）组织。&lt;/li&gt;
  &lt;li&gt;植物体从土壤中吸收水和无机盐的器官是（根）；进行光合作用的器官是（叶）。&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;第三单元&quot;&gt;第三单元&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;藻类植物：大多生活在水中，没有根、茎、叶的分化，能产生大量氧气。&lt;/li&gt;
  &lt;li&gt;苔藓植物：大多生活在陆地上的潮湿环境中；有茎叶的分化，有假根；许多苔藓植物的叶只有一层细胞；苔藓植物是监测空气污染程度的指示植物。&lt;/li&gt;
  &lt;li&gt;蕨类植物：有根、茎、叶的分化，有输导组织；与煤的形成有关。&lt;/li&gt;
  &lt;li&gt;种子的结构：
菜豆种子：种皮、胚（胚芽、胚轴、胚根、子叶[2片]）；
玉米种子：果皮和种皮、胚(胚芽、胚轴、胚根、子叶[1片])、胚乳。&lt;/li&gt;
  &lt;li&gt;种子植物包括裸子植物和被子植物。
①裸子植物：油松、侧柏、苏铁的种子是裸露着的，这样的植物称为裸子植物。
②被子植物：豌豆、荔枝、木瓜必须拨开果实才能看到种子，种子外面有果皮包被着的植物称为被子植物。被子植物是陆地上分布最为广泛的植物家族，一般都能开花结果。&lt;/li&gt;
  &lt;li&gt;种子植物比苔藓、蕨类更适应陆地的生活，其中一个重要的原因是能产生种子。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;一、种子的萌发&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;种子萌发的条件：环境条件：适宜的温度、一定的水分、充足的空气 ；自身条件：完整的有生命力的胚，已度过休眠期。&lt;/li&gt;
  &lt;li&gt;种子萌发的过程：吸收水分→转运营养→胚根发育成根→胚轴伸长→胚芽发育成芽→芽发育成茎和叶。&lt;/li&gt;
  &lt;li&gt;抽样检测：抽样检测是指从检测对象中抽取少量个体作为样本进行检测。以样本的检测结果来反映总体情况的方法。抽样时应尽量避免主观因素的影响。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;二、植株的生长&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;根尖的结构：根冠（保护）、分生区（分裂增生）、伸长区（伸长最快）、成熟区（外有根毛,内有导管,是吸收水分和无机盐的主要部位）&lt;/li&gt;
  &lt;li&gt;幼根的生长一方面要靠分生区细胞的分裂增加细胞的数量；另一方面要靠伸长区细胞的体积的增大。&lt;/li&gt;
  &lt;li&gt;枝条是由芽发育成的，植株的芽可以分为顶芽和侧芽，芽中的幼叶发育成叶，芽轴发育成茎，芽原基发育成芽。&lt;/li&gt;
  &lt;li&gt;植株生长需要营养物质：水、无机盐（需要量最多的是含氮的、含磷的含钾的无机盐）、有机物。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;三、开花和结果&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;花的主要结构是雄蕊和雌蕊
雄蕊：包括花药和花丝，雄蕊花药里有花粉，花粉中有精子；
雌蕊：包括柱头、花柱和子房，雌蕊下部的子房里有胚珠，胚珠里有卵细胞。
胚珠里的卵细胞和花粉管的精子结合，形成受精卵。&lt;/li&gt;
  &lt;li&gt;传粉：花粉从花药中散放而落在雌蕊柱头上的过程，叫做传粉。传粉方式一般有两种类型：自花传粉和异花传粉。&lt;/li&gt;
  &lt;li&gt;受精：胚珠里面的卵细胞，与来自花粉管中的精子结合，形成受精卵的过程，称为受精。&lt;/li&gt;
  &lt;li&gt;果实和种子的形成：子房→果实；子房壁→果皮；胚珠→种子；受精卵→胚。&lt;/li&gt;
  &lt;li&gt;因天气或其他原因造成减产，应当使用人工辅助授粉。&lt;/li&gt;
  &lt;li&gt;水分的吸收：植物主要通过根吸收水分，根吸收水分的主要部位是根尖成熟区。&lt;/li&gt;
  &lt;li&gt;水分的运输：水分在茎内运输的结构是导管，除茎以外，根和叶脉中也有导管，这些导管相互连接在一起，形成了水分运输的管网。&lt;/li&gt;
  &lt;li&gt;导管运输水和无机盐。筛管运输有机物。&lt;/li&gt;
  &lt;li&gt;蒸腾作用的概念：水分从活的植物体表面以水蒸气的状态散失到大气中的过程，叫做蒸腾作用。蒸腾作用主要是通过叶片进行的。&lt;/li&gt;
  &lt;li&gt;移栽树木时应注意：带土移栽（保护幼根和根毛）、剪掉枝叶（减少叶片总面积，降低蒸腾作用）、在阴天或傍晚移栽（弱光低温下，蒸腾作用较弱）、苗圃移栽后用黑网遮盖（气孔关闭，减少水分散失）&lt;/li&gt;
  &lt;li&gt;叶片的结构由表皮、叶肉与叶脉组成。保卫细胞控制气孔的张开与闭合。&lt;/li&gt;
  &lt;li&gt;光合作用的概念：光合作用实质上是绿色植物通过叶绿体，利用光能，把二氧化碳和水转化成储存能量的有机物（如淀粉），并且释放出氧气的过程。
二氧化碳+水→有机物+氧气。&lt;/li&gt;
  &lt;li&gt;呼吸作用的过程：（场所：主要在线粒体）分解有机物，释放能量。
有机物（储存能量）＋氧气→二氧化碳＋水＋能量。&lt;/li&gt;
&lt;/ol&gt;
</content>
 </entry>
 
 <entry>
   <title>信息技术程序设计练习题</title>
   <link href="https://comeround.cn/article/xinxi-note.html"/>
   <updated>2023-06-25T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/xinxi-note</id>
   <content type="html">&lt;h2 id=&quot;必背知识点&quot;&gt;必背知识点&lt;/h2&gt;

&lt;h5 id=&quot;填空题和选择题专用&quot;&gt;填空题和选择题专用&lt;/h5&gt;

&lt;ol&gt;
  &lt;li&gt;字长是CPU在单位时间内(同一时间)一次处理的二进制数的位数是衡量计算机性能的一个重要指标，字长越长一次处理的二进制数的位数越多，计算机的运算精度也就越高。&lt;/li&gt;
  &lt;li&gt;一个完整的微型计算机系统应包括（硬件系统和软件系统）。&lt;/li&gt;
  &lt;li&gt;世界上第一台电子计算机 ENIAC 是 1946 年在美国诞生的，主要采用电子管和继电器，主要用于弹道计算。&lt;/li&gt;
  &lt;li&gt;约翰·冯·诺依曼，“现代电子计算机之父”，他提出了现代电子计算机的基本硬件结构由五个部分组成，包括：运算器、控制器、存储器、输入和输出设备，至今计算机仍保持着这个结构。&lt;/li&gt;
  &lt;li&gt;人类社会资源体系的三大支柱为(物质、能量、信息)。&lt;/li&gt;
  &lt;li&gt;汉字的内码是在计算机内部对汉字进行存储、处理的汉字代码。字模即汉字的字形码，也称为汉字输出码。&lt;/li&gt;
  &lt;li&gt;一个汉字可以有多个输人码或字型码，但机内码只有一个。&lt;/li&gt;
  &lt;li&gt;BCD码是：用4位二进制数来表示1位十进制数中的0~9这10个数码。&lt;/li&gt;
  &lt;li&gt;三网融合是：电信网、计算机网和有线电视网。&lt;/li&gt;
  &lt;li&gt;计算机的发展趋势是：巨型化、微型化、网络化和智能化。&lt;/li&gt;
  &lt;li&gt;信息技术的发展趋势：多元化、网络化、多媒体化、智能化、虚拟化。&lt;/li&gt;
  &lt;li&gt;计算机的应用领域：科学计算、数据处理、过程控制、计算机辅助应用（CAE计算机辅助工程、CAT计算机辅助测试、CAM计算机辅助制造、CAI计算机辅助教学、CAD计算机辅助设计）、人工智能、电子商务、虚拟现实。&lt;/li&gt;
  &lt;li&gt;大数据处理流程包括：大数据采集、大数据预处理、大数据存储、大数据分析与挖掘以及结果展现与应用等五个步骤。&lt;/li&gt;
  &lt;li&gt;人工智能的应用领域包括：机器人、机器翻译、机器证明、智能代理、模式识别、自然语言理解、机器博弈、专家系统、机器学习等多个领域。&lt;/li&gt;
  &lt;li&gt;人工智能系统中知识的四个要素：（事实、规则、控制、元知识）。&lt;/li&gt;
  &lt;li&gt;ASCII占1个字节、UNICODE占2个字节、UTF-8占3至6个字节、GB2312-80占2个字节。&lt;/li&gt;
  &lt;li&gt;Windows7操作系统是一个（多用户、多任务）操作系统。&lt;/li&gt;
  &lt;li&gt;“存储程序和程序控制”是指将程序从存储位置自动取出并逐条执行。计算机硬件如何动作最终是由CPU所执行的指令决定。&lt;/li&gt;
  &lt;li&gt;计算机内存储器包括（RAM和ROM）。目前内存常用两类存储器器件：一类称为RAM，即随机存取存储器，其内容既允许存入，也允许取出，使用方便灵活，其缺点是切断机器电源时 RAM中的信息会丢失；另一类称为ROM，即只读存储器，其中存储的内容只能供反复读出，而不能重新写入。因此在ROM中存放的是固定不变的程序与数据，其优点是切断机器电源后，ROM中的信息仍然保留不会改变。&lt;/li&gt;
  &lt;li&gt;计算机的性能指标：机器字长、数据通路带宽、主存容量、运算速度、主频、存取周期。&lt;/li&gt;
  &lt;li&gt;MIPS是衡量计算机中运算速度的指标。&lt;/li&gt;
  &lt;li&gt;计算机所能安装的最大主存容量取决于（地址总线位数）。（单选：字长、控制总线位数、数据总线位数、地址总线位数）&lt;/li&gt;
  &lt;li&gt;计算机从取一条指令开始到执行完该指令所需要的时间称为一个（指令周期）。&lt;/li&gt;
  &lt;li&gt;CPU可以直接访问内存（内存储器），不可以直接访问外存（外存储器）。内存可以访问硬盘。&lt;/li&gt;
  &lt;li&gt;北桥芯片用来处理高速信号，通常处理中央处理器、存储器、PCIe显卡等设备的通信。南桥设计用来处理低速信号，如输入输出和硬盘接口的通信。&lt;/li&gt;
  &lt;li&gt;寄存器是CPU的组成部分，高速缓存只是集成到CPU封装，内存完全是和CPU独立的。所以在存取速度上寄存器最快，高速缓存次之，内存比高速缓存慢，外存最慢。高速缓冲器即Cache，其介于CPU与内存之间。&lt;/li&gt;
  &lt;li&gt;在软盘、硬盘和光盘中，存取速度最快的是硬盘，存取速度最慢的是软盘。&lt;/li&gt;
  &lt;li&gt;计算机硬盘接口可以分为IDE、SATA、SCSI、光纤通道和SAS五种。&lt;/li&gt;
  &lt;li&gt;计算机的主机由微处理器（CPU）和内存储器构成的部分。&lt;/li&gt;
  &lt;li&gt;按存储器在微机系统中所起的不同作用来分，可分为主存储器、辅助存储器、高速缓冲存储器。&lt;/li&gt;
  &lt;li&gt;将计算机的运算器、控制器集成在一块大规模集成电路芯片上，称为中央处理器。&lt;/li&gt;
  &lt;li&gt;总线是连接CPU、内存、缓存、外部控制芯片的数据通道。数据总线宽度决定了CPU与外部Cache、主存及输入输出设备之间进行一次数据传输的信息量。数据总线宽度指明了芯片的信息传递能力。地址总线的位数决定了CPU寻址范围。&lt;/li&gt;
  &lt;li&gt;主频＝外频×倍频（倍率）。外频＝300÷3＝100MHz。&lt;/li&gt;
  &lt;li&gt;计算机存储单元中存储的是数据或指令。&lt;/li&gt;
  &lt;li&gt;十进制数转换为二进制数时，小数部分用（乘2取整法）转换。&lt;/li&gt;
  &lt;li&gt;把用户要求计算机进行处理的一个计算问题称为一个作业，批量处理作业的操作系统为批处理操作系统，其实现了计算机操作的自动化。批处理操作系统分为批处理单道系统和批处理多道系统。&lt;/li&gt;
  &lt;li&gt;【分时操作系统、实时操作系统、网络操作系统】计算机网络是通过通信设施将地理上分散的计算机系统互连起来，实现信息交换、资源共享、互操作的系统。网络操作系统就是在原来各自计算机基本的操作系统之上，按照网络体系结构的各个协议标准开发的软件，包括网络管理、资源共享、通信、系统安全和多种网络服务等。&lt;/li&gt;
  &lt;li&gt;分时操作系统是一个联机的多用户交互式操作系统。分时系统一般采用时间片轮转的方式，使每一台计算机为多个终端用户服务。它具有以下特点：交互性、及时性、独立性。&lt;/li&gt;
  &lt;li&gt;数据库系统的特点主要有以下几个方面：（1）数据结构化；（2）数据的共享性高，冗余度低，易扩散；（3）数据由DBMS统一管理和控制。&lt;/li&gt;
  &lt;li&gt;数据库管理系统是位于用户和操作系统之间的数据管理软件。它和操作系统一样是计算机的系统软件，也是大型复杂的软件系统。&lt;/li&gt;
  &lt;li&gt;信息资源管理的三个阶段：传统管理阶段、技术管理阶段、资源管理阶段。&lt;/li&gt;
  &lt;li&gt;数据库管理的三个阶段：人工管理阶段、文件系统阶段、数据库管理系统阶段。&lt;/li&gt;
  &lt;li&gt;数据库模型的三要素：数据结构、数据操作和完整性约束（完整性规则、数据模型、数据操作）&lt;/li&gt;
  &lt;li&gt;关系模型支持实体完整性约束、参照完整性约束和用户自定义的完整性约束。&lt;/li&gt;
  &lt;li&gt;数据库的特点有：实现数据共享、减少数据的冗余度、数据的独立性和数据实现集中控制。学生可随时使用任何一部手机刷卡消费体现了数据库具有实现数据共享的特点。&lt;/li&gt;
  &lt;li&gt;数据库系统一般由数据库、数据库管理系统、应用程序、用户和硬件构成。&lt;/li&gt;
  &lt;li&gt;关系数据模型是用表格结构来表示实体类型以及实体间联系的模型。关系数据模型包括：关系数据模型的数据结构、关系数据模型的操纵、关系数据模型的完整性约束。&lt;/li&gt;
  &lt;li&gt;传统的关系运算包括并、交、差。专门关系代数的4个基本运算：选择、投影、连接、除。&lt;/li&gt;
  &lt;li&gt;用树形结构表示实体类型及实体间联系的数据模型称为层次模型，用有向图结构表示实体类型及实体间联系的数据模型称为网状模型，用二维表格结构表示实体及其联系的数据模型称为关系模型。&lt;/li&gt;
  &lt;li&gt;数据结构是研究数据元素及其之间的相互关系和数据运算的一门学科，它包含3个方面的内容，即数据的逻辑结构、存储结构和数据的运算。&lt;/li&gt;
  &lt;li&gt;数据结构课程中数据的逻辑结构分为线性结构和非线性结构。常用的线性结构有：线性表、栈、队列、双队列、数组、串。常见的非线性结构有：二维数组、多维数组、广义表、树（二叉树等）、图、集合。&lt;/li&gt;
  &lt;li&gt;对于栈，是后进先出；对于队列，是先进先出。&lt;/li&gt;
  &lt;li&gt;从逻辑结构上来划分，数据结构可以分为（线性结构、树形结构、图形结构和集合结构）。&lt;/li&gt;
  &lt;li&gt;按寄生方式的不同，可将计算机病毒分为引导型病毒、文件型病毒和复合型病毒3种。其中，引导型病毒是指寄生在磁盘引导区或主引导区的病毒；文件型病毒是指能够寄生在文件中的计算机病毒；复合型病毒是指具有引导型病毒和文件型病毒寄生方式的计算机病毒。&lt;/li&gt;
  &lt;li&gt;计算机网络主要的可实现的威胁：渗入威胁（假冒、旁路控制、授权侵犯），植入威胁（特洛伊木马、陷门）。&lt;/li&gt;
  &lt;li&gt;在电子商务应用系统中，通常使用数字签名技术来模拟文件或资料中的亲笔签名。数字签名的功能主要包括3个方面：保证信息传输过程中的完整性、发送者身份证和防止交易中的抵赖行为发生。&lt;/li&gt;
  &lt;li&gt;所谓防火墙指的是一个有软件和硬件设备组合而成、在内部网和外部网之间、专用网与公共网之间的界面上构造的保护屏障。防火墙可以限制访问内部主机、防止病毒入侵（不能杀毒）、统计网络流量。&lt;/li&gt;
  &lt;li&gt;网络安全最基本的技术是防火墙技术，最核心的技术是信息加密技术。&lt;/li&gt;
  &lt;li&gt;交换技术有三种，分别是：电路交换、报文交换、分组交换。局域网中的以太网采用的是分组交换技术。&lt;/li&gt;
  &lt;li&gt;网卡、网桥、交换机是工作在数据链路层。中继器、集线器工作在物理层。路由器（Router）工作在网络层。网关可以工作在网络层、传输层和应用层。&lt;/li&gt;
  &lt;li&gt;568A 绿白、绿、橙白、蓝、蓝白、橙、棕白、棕；568B 橙白、橙、绿白、蓝、蓝白、绿、棕白、棕（1326相转换）&lt;/li&gt;
  &lt;li&gt;计算机病毒具有传染性、寄生性、潜伏性、隐蔽性、可触发性、破坏性、不可预见性等特征。&lt;/li&gt;
  &lt;li&gt;资源子网和通信子网：通信子网包括通信设备（如中继器、集线器、网桥、路由器、网关等）、网络通信协议、通信控制软件等，负责信息的传输；资源子网包括计算机系统、终端、终端控制器、连网外设、各种软件资源与信息资源等。&lt;/li&gt;
  &lt;li&gt;信道复用技术：频分复用(FDM)、时分复用(TDM)、统计时分复用(STDM)、波分复用(WDM)、码分复用(CDM)。&lt;/li&gt;
  &lt;li&gt;在计算机网络中，网络协议主要要素为（语义、语法、时序）。（语义：解释控制信息每个部分的意义。语法：用户数据与控制信息的结构与格式，以及数据出现的顺序。时序：对事件发生顺序的详细说明）&lt;/li&gt;
  &lt;li&gt;FTP客户机和服务器之间一般需要建立(2)个连接，在使用FTP进行文件传输时，在客户机和服务器之间需要建立两个连接：控制连接和数据连接。&lt;/li&gt;
  &lt;li&gt;数据链路层协议的三个基本问题：封装成帧，透明传输，差错检测。&lt;/li&gt;
  &lt;li&gt;在Word中，特殊字符、公式和图片都是以对象的形式插入到文档中的，只有表格不是。表格中插入Word2010文档，是以对象插入。&lt;/li&gt;
  &lt;li&gt;最适合在网络中传输的动画类型是（Flash）。&lt;/li&gt;
  &lt;li&gt;FDDI是（双环令牌/光纤分布式数据接口）。FDDI使用双环令牌，传输速率可以达到100Mbps。由于支持高宽带和远距离通信网络，FDDI 通常用作骨干网。&lt;/li&gt;
  &lt;li&gt;LPT1是（并行口直接控制显示模块）。&lt;/li&gt;
  &lt;li&gt;第一个高级编程语言：FORTRAN。&lt;/li&gt;
  &lt;li&gt;云存储：指通过集群应用、网络技术或分布式文件系统等功能，将网络中大量各种不同类型的存储设备通过应用软件集合起来协同工作，共同对外提供数据存储和业务访问功能的一个系统。&lt;/li&gt;
  &lt;li&gt;云计算：云计算是分布式处理、并行处理（Parallel Computing）和网格计算的发展，或者说是这些计算机科学概念的商业实现。通过使计算分布在大量的分布式计算机上，而非本地计算机或远程服务器中，企业数据中心的运行将与互联网更相似。云计算的优点和缺点&lt;/li&gt;
  &lt;li&gt;射频技术（RF）是Radio Frequency的缩写。较常见的应用有无线射频识别&lt;/li&gt;
  &lt;li&gt;对信息的鉴别和评价主要从以下三个方面进行:从信息的来源进行判断、从信息的价值取向进行判断和从信息的时效性进行判断。&lt;/li&gt;
  &lt;li&gt;多媒体技术的特征包括（多样性、集成性、实时性、数字化和交互性）。&lt;/li&gt;
  &lt;li&gt;国标码=区位码+2020H，机内码=国标码+8080H=区位码+A0A0H。汉字的区位码2790(D)，机内码为（）。&lt;/li&gt;
  &lt;li&gt;WebQuest是一种基于网络资源、以探究为基础的学习活动，其中使用信息全部或者大部分来自网络。&lt;/li&gt;
  &lt;li&gt;Unicode划分为17个层面。&lt;/li&gt;
  &lt;li&gt;同一单元格内需要另起一行，快捷键是（Alt+Enter）&lt;/li&gt;
  &lt;li&gt;Excel=MAX(0,-1,TRUE)的值是1，true=1。&lt;/li&gt;
  &lt;li&gt;LWZ压缩：不属于常用的多媒体信息压缩标准。&lt;/li&gt;
  &lt;li&gt;在Windows环境中各个应用程序之间能够交换和共享信息是通过(剪贴板这个公共数据通道)来实现的。&lt;/li&gt;
  &lt;li&gt;VB表达式中包含mod、+、\ 、*四种运算符，其中*优先级最高，\是整除，次之，mod是求余，再次之，+是最低的。C语言是*和/同级别，从做到右计算。&lt;/li&gt;
  &lt;li&gt;将模拟音频信号在时间上进行离散化处理，这一过程叫(采样)。采样是把时间上连续的模拟信号在时间轴上离散化的过程。量化的主要工作就是将幅度上连续取值的每一个样本转换为离散值表示。编码是整个声音数字化的储存和处理。&lt;/li&gt;
  &lt;li&gt;汉诺(Hanoi)塔问题通常采用递归方法解决。&lt;/li&gt;
  &lt;li&gt;PhotoShop中，色阶的快捷键（Ctrl+L），曲线的快捷键（Ctrl+M），色相饱和度的快捷键（Ctrl+U），Shift+F5填充，Shift+F6羽化&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;c语言程序设计&quot;&gt;C语言程序设计&lt;/h2&gt;

&lt;h5 id=&quot;求100-500的质数&quot;&gt;求100-500的质数&lt;/h5&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
           &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
              &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
           &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d是质数&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d不是质数&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;c语言出租车计费&quot;&gt;C语言出租车计费&lt;/h5&gt;

&lt;p&gt;出租车计费问题。起步价10元 (三公里内)，3~ 10公里之间的每公里2.1元，超出10公里部分每公里3元。输入行车里程，得出总费用。&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;cpf&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;float&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Please input a:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;scanf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;输入错误，请重新输入&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;费用为 %f&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;c语言基本运算&quot;&gt;C语言基本运算&lt;/h5&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&amp;lt;stdlib.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//先用后加；100&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;//先加后用；101&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//先加后用；102&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//先用后加；-102&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;//先加后用；103&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//即时赋值；5&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//及时赋值；8-5=3&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;水仙花程序&quot;&gt;水仙花程序&lt;/h5&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                    &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d %d %d &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;指针基础&quot;&gt;指针基础&lt;/h5&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt; &lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;递归调用迭代求a的阶乘&quot;&gt;递归调用（迭代）求a的阶乘&lt;/h5&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;fib&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fib&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fib&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;冒泡排序法求10个数字的排序&quot;&gt;冒泡排序法求10个数字的排序&lt;/h5&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;temp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;temp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;temp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;k&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d,&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;8,7,6,5,4,3,2,1,0,9,
7,6,5,4,3,2,1,0,8,9,
6,5,4,3,2,1,0,7,8,9,
5,4,3,2,1,0,6,7,8,9,
4,3,2,1,0,5,6,7,8,9,
3,2,1,0,4,5,6,7,8,9,
2,1,0,3,4,5,6,7,8,9,
1,0,2,3,4,5,6,7,8,9,
0,1,2,3,4,5,6,7,8,9,
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;选择排序&quot;&gt;选择排序&lt;/h5&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
&lt;/span&gt; 
&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;84&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;78&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;21&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;38&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;temp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;temp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;temp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;//printf(&quot;%d和%d交换\n&quot;,a[i],a[k]);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;输出菱形图案&quot;&gt;输出菱形图案&lt;/h5&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;--*
-***
*****
-***
--*
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;函数返回数组&quot;&gt;函数返回数组&lt;/h5&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;arrs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//在这里排序好&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;34&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arrs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%d &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;vb程序设计&quot;&gt;VB程序设计&lt;/h3&gt;

&lt;p&gt;字符串处理&lt;/p&gt;

&lt;div class=&quot;language-vb highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;Dim&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;abcdefg&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;&apos;efg&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;&apos;abc&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Mid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;&apos;cd&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;a&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;b&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Then&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;真&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;caaaaa&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;d&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Then&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;真&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-vb highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Sub&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Command1_Click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Dim&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Double&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Dim&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Integer&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Dim&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Boolbean&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Dim&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;13000000000&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Do&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;While&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2600000000&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;1.008&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Loop&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Then&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;___&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Else&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;___&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;Dim&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Integer&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Dim&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Integer&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;To&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;___&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Next&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;To&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;To&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;S&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;*&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;=&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Tab&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;S&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;Next&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Next&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;To&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Step&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Next&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;Select&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;Case&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;___&quot;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;Case&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;___&quot;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;Case&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;___&quot;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;Case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;else&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;___&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Select&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Dim&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Integer&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;InputBox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;请输入要判断的年份&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;Mod&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;And&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;Mod&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;Or&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;Mod&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;400&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Then&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;MsgBox&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;是闰年&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Else&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;MsgBox&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;不是闰年&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Sub&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;vb的选择排序&quot;&gt;VB的选择排序&lt;/h5&gt;

&lt;div class=&quot;language-vb highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Sub&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Command1_Click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Dim&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Single&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;InputBox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;请输入数据的总数里&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;To&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;InputBox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;请输入第&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;个数据&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Next&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;To&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Next&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;To&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Min&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;To&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Min&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Then&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;Min&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;Next&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;
        
        &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Then&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;交换&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;和&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;k&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Min&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;To&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;Next&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Next&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Sub&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;生成20个10-100的随机数然后统计5的整数倍的和&lt;/p&gt;

&lt;div class=&quot;language-vb highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Sub&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Command1_Click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Dim&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;m&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Integer&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Dim&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;sum&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Integer&lt;/span&gt;    
    &lt;span class=&quot;n&quot;&gt;sum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;To&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Rnd&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;91&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;Mod&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Then&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;sum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Next&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;m&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;sum=&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sum&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Sub&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;python语言备考&quot;&gt;Python语言备考&lt;/h3&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#整除得2
&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#10的4次方
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#输出0到5
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#输出6到9
&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#输出True
&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#输出False
&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;R&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\0&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;S&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\0&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#输出5
&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;大海&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;蓝色&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;天空&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;灰色&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;大地&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;黑色&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;大地&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;            &lt;span class=&quot;c1&quot;&gt;#黑色
&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;天空&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;黄色&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#灰色
&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;学校&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;黄色&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#黄色
&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>线性代数与Python</title>
   <link href="https://comeround.cn/article/linear-algebra-and-python.html"/>
   <updated>2023-06-05T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/linear-algebra-and-python</id>
   <content type="html">&lt;h2 id=&quot;1基础&quot;&gt;（1）基础&lt;/h2&gt;

&lt;h5 id=&quot;安装&quot;&gt;安装&lt;/h5&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pip &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;numpy
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;引入&quot;&gt;引入&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;numpy&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;创建矩阵&quot;&gt;创建矩阵&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;0 1 2;1 0 3;4 -3 8&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;19&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]])&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;B&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;19&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]])&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;C&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eye&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;        &lt;span class=&quot;c1&quot;&gt;#三阶单位矩阵
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;D&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;diag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#三阶对角矩阵
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;E&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;zeros&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;#三阶零矩阵
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;求逆矩阵&quot;&gt;求逆矩阵&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;A1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;linalg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;inv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;矩阵的秩&quot;&gt;矩阵的秩&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;linalg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;matrix_rank&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;矩阵的乘法&quot;&gt;矩阵的乘法&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;C&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;矩阵的转置&quot;&gt;矩阵的转置&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;T&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;矩阵a的行列式的值&quot;&gt;矩阵A的行列式的值&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;A1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;linalg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;det&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;矩阵的特征值和特征向量&quot;&gt;矩阵的特征值和特征向量&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;linalg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;eig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;C&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;特征值：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;特征向量：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;伴随矩阵&quot;&gt;伴随矩阵&lt;/h5&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;Astar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;linalg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;inv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;linalg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;det&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;2可逆矩阵与逆运算&quot;&gt;（2）可逆矩阵与逆运算&lt;/h2&gt;

&lt;p&gt;需要传递的明文信息为矩阵B，以矩阵A作为加密密钥，得到矩阵C，使用矩阵A的逆还原矩阵B&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;numpy&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;B&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;19&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]])&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;矩阵B：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]])&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;矩阵A：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;C&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;矩阵C：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;C&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;矩阵A逆：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;A1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;linalg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;inv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;B1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;A1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;C&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;还原矩阵B：&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;B1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;矩阵B：
[[ 1 14 20  1]
 [15 15  8 19]
 [ 0 18  5 20]]
矩阵A：
[[ 1  1  1]
 [-1  0  1]
 [ 0  1  1]]
矩阵C：
[[ 16  47  33  40]
 [ -1   4 -15  19]
 [ 15  33  13  39]]
矩阵A逆：
[[ 1.  0. -1.]
 [-1. -1.  2.]
 [ 1.  1. -1.]]
还原矩阵B：
[[ 1. 14. 20.  1.]
 [15. 15.  8. 19.]
 [ 0. 18.  5. 20.]]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;https://www.runoob.com/numpy/numpy-linear-algebra.html&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>源码编译RPM安装包</title>
   <link href="https://comeround.cn/article/source-code-build-rpm.html"/>
   <updated>2023-06-01T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/source-code-build-rpm</id>
   <content type="html">&lt;h2 id=&quot;1编译最新版本nginx&quot;&gt;（1）编译最新版本Nginx&lt;/h2&gt;

&lt;h5 id=&quot;安装rpm-build软件包&quot;&gt;安装rpm-build软件包&lt;/h5&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yum -y install rpm-build&lt;/code&gt;&lt;/p&gt;

&lt;h5 id=&quot;生成rpmbuild目录结构&quot;&gt;生成rpmbuild目录结构&lt;/h5&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rpmbuild -ba nginx.spec&lt;/code&gt;&lt;/p&gt;

&lt;h5 id=&quot;将源码软件复制到sources目录&quot;&gt;将源码软件复制到SOURCES目录&lt;/h5&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cd /root/rpmbuild/SOURCES/ &amp;amp;&amp;amp; wget https://nginx.org/download/nginx-1.24.0.tar.gz&lt;/code&gt;&lt;/p&gt;

&lt;h5 id=&quot;创建并修改spec配置文件&quot;&gt;创建并修改SPEC配置文件&lt;/h5&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vim /root/rpmbuild/SPECS/nginx.spec&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-conf highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;Name&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;nginx&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Version&lt;/span&gt;:&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;24&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Release&lt;/span&gt;:&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Summary&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;nginx&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;is&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;web&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;server&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;Group&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;nginx&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;License&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;GPL&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;URL&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;nginx&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;org&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Source0&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;nginx&lt;/span&gt;-&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;24&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;tar&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;gz&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Source1&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;nginx&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;#BuildRequires:
#Requires:
&lt;/span&gt;
%&lt;span class=&quot;n&quot;&gt;description&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;this&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;is&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;web&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;server&lt;/span&gt;

%&lt;span class=&quot;n&quot;&gt;prep&lt;/span&gt;
%&lt;span class=&quot;n&quot;&gt;setup&lt;/span&gt; -&lt;span class=&quot;n&quot;&gt;q&lt;/span&gt;

%&lt;span class=&quot;n&quot;&gt;build&lt;/span&gt;
./&lt;span class=&quot;n&quot;&gt;configure&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;make&lt;/span&gt; %{?&lt;span class=&quot;err&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;smp_mflags&lt;/span&gt;}

%&lt;span class=&quot;n&quot;&gt;install&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;make&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DESTDIR&lt;/span&gt;=%{&lt;span class=&quot;n&quot;&gt;buildroot&lt;/span&gt;}
&lt;span class=&quot;n&quot;&gt;install&lt;/span&gt; -&lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; -&lt;span class=&quot;n&quot;&gt;D&lt;/span&gt; -&lt;span class=&quot;n&quot;&gt;m&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0755&lt;/span&gt; %{&lt;span class=&quot;n&quot;&gt;SOURCE1&lt;/span&gt;} %{&lt;span class=&quot;n&quot;&gt;buildroot&lt;/span&gt;}/&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;init&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;nginx&lt;/span&gt;

%&lt;span class=&quot;n&quot;&gt;files&lt;/span&gt;
%&lt;span class=&quot;n&quot;&gt;doc&lt;/span&gt;
/&lt;span class=&quot;n&quot;&gt;usr&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;local&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;nginx&lt;/span&gt;/*
/&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;init&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;nginx&lt;/span&gt;

%&lt;span class=&quot;n&quot;&gt;changelog&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;说明1&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;以下3行代码的目的是将&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/rpmbuild/SOURCES/nginx&lt;/code&gt;文件生成为系统的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/init.d/nginx&lt;/code&gt;文件，也可对原文件覆盖&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Source1:nginx
install -p -D -m 0755 %{SOURCE1} %{buildroot}/etc/init.d/nginx
/etc/init.d/nginx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;编译过程&quot;&gt;编译过程&lt;/h5&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rpmbuild -ba rpmbuild/SPECS/nginx.spec&lt;/code&gt;&lt;/p&gt;

&lt;h5 id=&quot;查看编译文件&quot;&gt;查看编译文件&lt;/h5&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ll /root/rpmbuild/RPMS/x86_64/&lt;/code&gt;&lt;/p&gt;

&lt;h5 id=&quot;查看包信息&quot;&gt;查看包信息&lt;/h5&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2023/rpm-build-nginx.png&quot; alt=&quot;判断顶底区域&quot; /&gt;&lt;/p&gt;

&lt;h5 id=&quot;测试安装结果&quot;&gt;测试安装结果&lt;/h5&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rpm -ivh /root/rpmbuild/RPMS/x86_64/nginx-1.24.0-1.x86_64.rpm&lt;/code&gt;&lt;/p&gt;

&lt;h5 id=&quot;设置软链&quot;&gt;设置软链&lt;/h5&gt;

&lt;p&gt;ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx&lt;/p&gt;

&lt;h5 id=&quot;设置启动&quot;&gt;设置启动&lt;/h5&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vim /etc/init.d/nginx&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;2编译最新版本ruby&quot;&gt;（2）编译最新版本Ruby&lt;/h2&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;./configure --prefix=/usr/local/ruby&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rpm -ivh 包名 --nodeps --force&lt;/code&gt;&lt;/p&gt;

&lt;h6 id=&quot;失败了&quot;&gt;失败了&lt;/h6&gt;

&lt;h2 id=&quot;3把文件打包到rpm包中&quot;&gt;（3）把文件打包到rpm包中&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Name:webfiles
Version:1.1.2
Release:1%{?dist}
Summary:this is a file package

Group:gihub
License:GPL
URL:github.cn
#Source0:bbb
Source1:aaa
Source2:index.html
Source3:0602.html
Source4:folder

#BuildRequires:
#Requires:
%description
this is files
#%prep
#%setup -q
#%build
%install
install -p -D -m 0755 %{SOURCE1} %{buildroot}/webfiles/nginx2
install -p -D -m 0755 %{SOURCE2} %{buildroot}/webfiles/index.html
install -p -D -m 0755 %{SOURCE3} %{buildroot}/webfiles/0602.html
mkdir %{buildroot}/webfiles/folder/ #不会自动创建文件夹，要先创建文件夹
install -p -D -m 0755 %{SOURCE4}/* %{buildroot}/webfiles/folder
#cp -ar %{SOURCE4}/* %{buildroot}/webfiles/folder/ #或者用这行代码
%files
/webfiles/folder
%doc
/webfiles/nginx2
/webfiles/index.html
/webfiles/0602.html
#/webfiles/folder
%changelog
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;!-- https://www.cnblogs.com/weijing24/p/5691283.html --&gt;
</content>
 </entry>
 
 <entry>
   <title>电脑维护指南</title>
   <link href="https://comeround.cn/article/computer-operate.html"/>
   <updated>2023-02-06T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/computer-operate</id>
   <content type="html">&lt;h3 id=&quot;一装机笔记&quot;&gt;一、装机笔记&lt;/h3&gt;

&lt;h5 id=&quot;配置草稿&quot;&gt;配置草稿&lt;/h5&gt;

&lt;p&gt;AMD的CPU：Ryzen5、Ryzen7&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;硬件名称&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;配置&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;价格&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;其他&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;主板&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;B660M-P&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;1280&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;处理器&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;Core i5 12400F&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;内存&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;16GB&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;硬盘&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;500GB&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电源&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;550W&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;显卡&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;GTX1660S&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.mydrivers.com/zhuanti/tianti/cpu/&quot;&gt;桌面CPU性能天梯图&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.mydrivers.com/zhuanti/tianti/cpu/index_intel.html&quot;&gt;Intel桌面处理器规格表&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;主板和cpu匹配&quot;&gt;主板和CPU匹配&lt;/h5&gt;

&lt;p&gt;A、1代Intel酷睿台式机使用的CPU针脚是LGA 1156针，对应主板型号：H55，可用CPU比如i5-680，i3-560，i7-870。&lt;/p&gt;

&lt;p&gt;B、2、3代台式机Intel酷睿CPU，针脚是LGA 1155针，对应的主板型号：H61、B75，可用CPU比如：i3-2100、i5-3330、i7-2600。&lt;/p&gt;

&lt;p&gt;C、4代台式机Intel酷睿CPU，针脚是LGA 1150针，对应的主板型号：H81、B85，可用CPU比如：i3-4130、i5-4590、i7-4790。&lt;/p&gt;

&lt;p&gt;D、6-9代的台式机Intel酷睿CPU，针脚是LGA 1151针，对应的主板型号：H110、B250、B365、H310，可用CPU比如：i3-6300、i5-8500、i5-7400、i7-9700。&lt;/p&gt;

&lt;p&gt;E、10代、11代台式机Intel酷睿CPU，针脚是LGA 1200针，对应的主板型号：10代主板H410、B460，11代主板H510、B560。可用CPU比如：i3-10100、i5-10500、i7-10700F、i9-10900。&lt;/p&gt;

&lt;p&gt;F、12代、13代台式机Intel酷睿CPU，针脚是LGA 1700针，对应主板型号：13代主板：Z790、B760，12代主板H610、B660，可用CPU比如：i9 13900、i9 12900、i7 13700、i7 12700K、i5 13600、i5 12600、i3 13100、i3 12300。&lt;/p&gt;

&lt;h5 id=&quot;常见处理器&quot;&gt;常见处理器&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;酷睿系列：
    &lt;ul&gt;
      &lt;li&gt;第7代酷睿 (2017-2018)：Kaby Lake 架构&lt;/li&gt;
      &lt;li&gt;第8代酷睿 (2018-2019)：Coffee Lake 架构&lt;/li&gt;
      &lt;li&gt;第9代酷睿 (2018-2019)：Coffee Lake Refresh&lt;/li&gt;
      &lt;li&gt;第10代酷睿 (2019-2021)&lt;/li&gt;
      &lt;li&gt;第11代酷睿 (2021)&lt;/li&gt;
      &lt;li&gt;第12代酷睿 (2021-2022)：Alder Lake 架构&lt;/li&gt;
      &lt;li&gt;第13代酷睿 (2022-2023)：Raptor Lake 架构&lt;/li&gt;
      &lt;li&gt;第14代酷睿 (2023)：Raptor Lake Refresh（i5-14400F）&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Core Ultra 系列
    &lt;ul&gt;
      &lt;li&gt;Series 1 (2023-2024)：Meteor Lake 架构-（Ultra 5 135H） 【14代】&lt;/li&gt;
      &lt;li&gt;Series 2 (2024)：Arrow Lake 架构-（Ultra 5 245F） 【15代】&lt;/li&gt;
      &lt;li&gt;Series 3 (2025-2026) Panther Lake 架构-（Ultra 5 300F+）&lt;/li&gt;
      &lt;li&gt;Series 4 (2026) Nova Lake 架构-（Ultra 5 400F+）&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;至强系列：
    &lt;ul&gt;
      &lt;li&gt;E5-2689v0（Sandy Bridge 架构，2012 年）：
  8 核 16 线程，2.6GHz 基础 / 3.6GHz 睿频，20MB 缓存，115W TDP，LGA2011 接口，32nm 工艺&lt;/li&gt;
      &lt;li&gt;E5-2696v4（Broadwell 架构，2016 年）：
  22 核 44 线程，2.2GHz 基础 / 3.6GHz 睿频，55MB 缓存，145W TDP，LGA2011-3 接口，14nm 工艺&lt;/li&gt;
      &lt;li&gt;E5-2680v4：14 核 28 线程，2.4GHz 基础 / 3.8GHz 睿频，35MB 缓存&lt;/li&gt;
      &lt;li&gt;E5-2699v4：22 核 44 线程，2.2GHz 基础 / 3.6GHz 睿频，55MB 缓存&lt;/li&gt;
      &lt;li&gt;E5-2650v4：10 核 20 线程，2.2GHz 基础 / 3.0GHz 睿频，25MB 缓存&lt;/li&gt;
      &lt;li&gt;E3-1230v3：4 核 8 线程，3.3GHz 基础 / 3.7GHz 睿频，8MB 缓存，80W TDP&lt;/li&gt;
      &lt;li&gt;E3-1231v3&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;型号&lt;/th&gt;
      &lt;th&gt;核心数&lt;/th&gt;
      &lt;th&gt;线程数&lt;/th&gt;
      &lt;th&gt;制作工艺&lt;/th&gt;
      &lt;th&gt;TDP&lt;/th&gt;
      &lt;th&gt;年份&lt;/th&gt;
      &lt;th&gt;PassMark 多核跑分&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;E5-2630v3&lt;/td&gt;
      &lt;td&gt;8&lt;/td&gt;
      &lt;td&gt;16&lt;/td&gt;
      &lt;td&gt;22 纳米&lt;/td&gt;
      &lt;td&gt;85W&lt;/td&gt;
      &lt;td&gt;2014&lt;/td&gt;
      &lt;td&gt;13800&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;E5-2650v4&lt;/td&gt;
      &lt;td&gt;12&lt;/td&gt;
      &lt;td&gt;24&lt;/td&gt;
      &lt;td&gt;14 纳米&lt;/td&gt;
      &lt;td&gt;105W&lt;/td&gt;
      &lt;td&gt;2016&lt;/td&gt;
      &lt;td&gt;18200&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;E5-2666v3&lt;/td&gt;
      &lt;td&gt;10&lt;/td&gt;
      &lt;td&gt;20&lt;/td&gt;
      &lt;td&gt;22 纳米&lt;/td&gt;
      &lt;td&gt;135W&lt;/td&gt;
      &lt;td&gt;2014&lt;/td&gt;
      &lt;td&gt;19500&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;E5-2673v3&lt;/td&gt;
      &lt;td&gt;12&lt;/td&gt;
      &lt;td&gt;24&lt;/td&gt;
      &lt;td&gt;22 纳米&lt;/td&gt;
      &lt;td&gt;135W&lt;/td&gt;
      &lt;td&gt;2014&lt;/td&gt;
      &lt;td&gt;21000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;E5-2676v3&lt;/td&gt;
      &lt;td&gt;12&lt;/td&gt;
      &lt;td&gt;24&lt;/td&gt;
      &lt;td&gt;22 纳米&lt;/td&gt;
      &lt;td&gt;120W&lt;/td&gt;
      &lt;td&gt;2014&lt;/td&gt;
      &lt;td&gt;22300&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;E5-2680v3&lt;/td&gt;
      &lt;td&gt;12&lt;/td&gt;
      &lt;td&gt;24&lt;/td&gt;
      &lt;td&gt;22 纳米&lt;/td&gt;
      &lt;td&gt;120W&lt;/td&gt;
      &lt;td&gt;2014&lt;/td&gt;
      &lt;td&gt;23500&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;E5-2683v3&lt;/td&gt;
      &lt;td&gt;14&lt;/td&gt;
      &lt;td&gt;28&lt;/td&gt;
      &lt;td&gt;22 纳米&lt;/td&gt;
      &lt;td&gt;120W&lt;/td&gt;
      &lt;td&gt;2014&lt;/td&gt;
      &lt;td&gt;25000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;E5-2680v4&lt;/td&gt;
      &lt;td&gt;14&lt;/td&gt;
      &lt;td&gt;28&lt;/td&gt;
      &lt;td&gt;14 纳米&lt;/td&gt;
      &lt;td&gt;120W&lt;/td&gt;
      &lt;td&gt;2016&lt;/td&gt;
      &lt;td&gt;27800&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;E5-2696v4&lt;/td&gt;
      &lt;td&gt;22&lt;/td&gt;
      &lt;td&gt;44&lt;/td&gt;
      &lt;td&gt;14 纳米&lt;/td&gt;
      &lt;td&gt;145W&lt;/td&gt;
      &lt;td&gt;2016&lt;/td&gt;
      &lt;td&gt;38000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;E5-2699v4&lt;/td&gt;
      &lt;td&gt;22&lt;/td&gt;
      &lt;td&gt;44&lt;/td&gt;
      &lt;td&gt;14 纳米&lt;/td&gt;
      &lt;td&gt;145W&lt;/td&gt;
      &lt;td&gt;2016&lt;/td&gt;
      &lt;td&gt;39500&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h5 id=&quot;特殊cpu记录&quot;&gt;特殊CPU记录&lt;/h5&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;处理器型号&lt;/th&gt;
      &lt;th&gt;生产年份&lt;/th&gt;
      &lt;th&gt;处理器代数&lt;/th&gt;
      &lt;th&gt;核心线程数&lt;/th&gt;
      &lt;th&gt;性能特点&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;N95&lt;/td&gt;
      &lt;td&gt;2023 年&lt;/td&gt;
      &lt;td&gt;Alder Lake-N&lt;/td&gt;
      &lt;td&gt;4-4&lt;/td&gt;
      &lt;td&gt;睿频至高可达 3.40GHz，6M 高速缓存，TDP 为 15W，性能在 N 系列中相对较好，可满足日常办公及轻度娱乐需求。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;N100&lt;/td&gt;
      &lt;td&gt;2023 年&lt;/td&gt;
      &lt;td&gt;Alder Lake-N&lt;/td&gt;
      &lt;td&gt;4-4&lt;/td&gt;
      &lt;td&gt;主频 0.8GHz，睿频至高可达 3.40GHz，6M 高速缓存，TDP 仅 6W，功耗较低，适合对功耗要求严格的设备，能处理简单办公任务。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;N97&lt;/td&gt;
      &lt;td&gt;2023 年&lt;/td&gt;
      &lt;td&gt;Alder Lake-N&lt;/td&gt;
      &lt;td&gt;4-4&lt;/td&gt;
      &lt;td&gt;最高睿频可达 3.60GHz，6M 缓存，TDP 为 12W，性能在同系列中较强，图形处理能力相对较好，可支持 4K 视频播放。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;N5095&lt;/td&gt;
      &lt;td&gt;2021 年&lt;/td&gt;
      &lt;td&gt;Jasper Lake&lt;/td&gt;
      &lt;td&gt;4-4&lt;/td&gt;
      &lt;td&gt;处理器基本频率 2.00GHz，睿频至高可达 2.90GHz，4M 高速缓存，TDP 为 15W，性能可满足基本办公，如文档编辑、网页浏览等。（赛扬处理器）&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;N5105&lt;/td&gt;
      &lt;td&gt;2021 年&lt;/td&gt;
      &lt;td&gt;Jasper Lake&lt;/td&gt;
      &lt;td&gt;4-4&lt;/td&gt;
      &lt;td&gt;基本频率 2.00GHz，睿频可达 2.90GHz，4M 高速缓存，TDP 为 10W，相比 N5095，功耗控制更好，性能表现相近，常用于小型主机等设备。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;N5030&lt;/td&gt;
      &lt;td&gt;2019 年&lt;/td&gt;
      &lt;td&gt;Gemini Lake Refresh&lt;/td&gt;
      &lt;td&gt;4-4&lt;/td&gt;
      &lt;td&gt;处理器基本频率 1.10GHz，高达 3.10GHz，4M 高速缓存，TDP 较低，性能相对较弱，主要用于入门级办公设备或一些对性能要求不高的嵌入式场景。&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h5 id=&quot;amd锐龙处理器型号&quot;&gt;AMD锐龙处理器型号&lt;/h5&gt;

&lt;p&gt;AMD锐龙处理器概览（2019–2025）&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;型号&lt;/th&gt;
      &lt;th&gt;发布时间&lt;/th&gt;
      &lt;th&gt;核心/线程&lt;/th&gt;
      &lt;th&gt;制程工艺&lt;/th&gt;
      &lt;th&gt;基础/加速频率&lt;/th&gt;
      &lt;th&gt;总缓存&lt;/th&gt;
      &lt;th&gt;TDP&lt;/th&gt;
      &lt;th&gt;架构&lt;/th&gt;
      &lt;th&gt;核显&lt;/th&gt;
      &lt;th&gt;平台&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;锐龙9 9955HX3D&lt;/td&gt;
      &lt;td&gt;2025-Q2&lt;/td&gt;
      &lt;td&gt;16C/32T&lt;/td&gt;
      &lt;td&gt;4nm&lt;/td&gt;
      &lt;td&gt;待公布/待公布&lt;/td&gt;
      &lt;td&gt;待公布&lt;/td&gt;
      &lt;td&gt;待公布&lt;/td&gt;
      &lt;td&gt;Zen 5&lt;/td&gt;
      &lt;td&gt;待公布&lt;/td&gt;
      &lt;td&gt;移动&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;锐龙9 9950X&lt;/td&gt;
      &lt;td&gt;2025-Q1&lt;/td&gt;
      &lt;td&gt;16C/32T&lt;/td&gt;
      &lt;td&gt;4nm&lt;/td&gt;
      &lt;td&gt;4.3GHz/5.8GHz&lt;/td&gt;
      &lt;td&gt;80MB&lt;/td&gt;
      &lt;td&gt;170W&lt;/td&gt;
      &lt;td&gt;Zen 5&lt;/td&gt;
      &lt;td&gt;无&lt;/td&gt;
      &lt;td&gt;桌面&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;锐龙7 8840HS&lt;/td&gt;
      &lt;td&gt;2024-Q1&lt;/td&gt;
      &lt;td&gt;8C/16T&lt;/td&gt;
      &lt;td&gt;4nm&lt;/td&gt;
      &lt;td&gt;3.8GHz/5.1GHz&lt;/td&gt;
      &lt;td&gt;24MB&lt;/td&gt;
      &lt;td&gt;28-54W&lt;/td&gt;
      &lt;td&gt;Zen 4&lt;/td&gt;
      &lt;td&gt;Radeon 780M&lt;/td&gt;
      &lt;td&gt;移动&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;锐龙7 8700G&lt;/td&gt;
      &lt;td&gt;2024-Q1&lt;/td&gt;
      &lt;td&gt;8C/16T&lt;/td&gt;
      &lt;td&gt;4nm&lt;/td&gt;
      &lt;td&gt;4.2GHz/5.1GHz&lt;/td&gt;
      &lt;td&gt;24MB&lt;/td&gt;
      &lt;td&gt;65W&lt;/td&gt;
      &lt;td&gt;Zen 4&lt;/td&gt;
      &lt;td&gt;Radeon 780M&lt;/td&gt;
      &lt;td&gt;桌面&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;锐龙7 7745HX&lt;/td&gt;
      &lt;td&gt;2023-Q2&lt;/td&gt;
      &lt;td&gt;8C/16T&lt;/td&gt;
      &lt;td&gt;5nm&lt;/td&gt;
      &lt;td&gt;3.6GHz/5.1GHz&lt;/td&gt;
      &lt;td&gt;40MB&lt;/td&gt;
      &lt;td&gt;55W+&lt;/td&gt;
      &lt;td&gt;Zen 4&lt;/td&gt;
      &lt;td&gt;无&lt;/td&gt;
      &lt;td&gt;移动&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;锐龙7 7735H&lt;/td&gt;
      &lt;td&gt;2023-Q1&lt;/td&gt;
      &lt;td&gt;8C/16T&lt;/td&gt;
      &lt;td&gt;6nm&lt;/td&gt;
      &lt;td&gt;3.2GHz/4.75GHz&lt;/td&gt;
      &lt;td&gt;20MB&lt;/td&gt;
      &lt;td&gt;35-54W&lt;/td&gt;
      &lt;td&gt;Zen 3+&lt;/td&gt;
      &lt;td&gt;Radeon 680M&lt;/td&gt;
      &lt;td&gt;移动&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;锐龙9 7950X&lt;/td&gt;
      &lt;td&gt;2022-Q3&lt;/td&gt;
      &lt;td&gt;16C/32T&lt;/td&gt;
      &lt;td&gt;5nm&lt;/td&gt;
      &lt;td&gt;4.5GHz/5.7GHz&lt;/td&gt;
      &lt;td&gt;80MB&lt;/td&gt;
      &lt;td&gt;170W&lt;/td&gt;
      &lt;td&gt;Zen 4&lt;/td&gt;
      &lt;td&gt;Radeon 610M&lt;/td&gt;
      &lt;td&gt;桌面&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;锐龙7 7700X&lt;/td&gt;
      &lt;td&gt;2022-Q3&lt;/td&gt;
      &lt;td&gt;8C/16T&lt;/td&gt;
      &lt;td&gt;5nm&lt;/td&gt;
      &lt;td&gt;4.5GHz/5.4GHz&lt;/td&gt;
      &lt;td&gt;40MB&lt;/td&gt;
      &lt;td&gt;105W&lt;/td&gt;
      &lt;td&gt;Zen 4&lt;/td&gt;
      &lt;td&gt;Radeon 610M&lt;/td&gt;
      &lt;td&gt;桌面&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;锐龙5 7600X&lt;/td&gt;
      &lt;td&gt;2022-Q3&lt;/td&gt;
      &lt;td&gt;6C/12T&lt;/td&gt;
      &lt;td&gt;5nm&lt;/td&gt;
      &lt;td&gt;4.7GHz/5.3GHz&lt;/td&gt;
      &lt;td&gt;38MB&lt;/td&gt;
      &lt;td&gt;105W&lt;/td&gt;
      &lt;td&gt;Zen 4&lt;/td&gt;
      &lt;td&gt;Radeon 610M&lt;/td&gt;
      &lt;td&gt;桌面&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;锐龙9 6900HX&lt;/td&gt;
      &lt;td&gt;2022-Q1&lt;/td&gt;
      &lt;td&gt;8C/16T&lt;/td&gt;
      &lt;td&gt;6nm&lt;/td&gt;
      &lt;td&gt;3.3GHz/4.9GHz&lt;/td&gt;
      &lt;td&gt;20MB&lt;/td&gt;
      &lt;td&gt;45W&lt;/td&gt;
      &lt;td&gt;Zen 3+&lt;/td&gt;
      &lt;td&gt;Radeon 680M&lt;/td&gt;
      &lt;td&gt;移动&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;锐龙7 5800X3D&lt;/td&gt;
      &lt;td&gt;2021-Q4&lt;/td&gt;
      &lt;td&gt;8C/16T&lt;/td&gt;
      &lt;td&gt;7nm&lt;/td&gt;
      &lt;td&gt;3.4GHz/4.5GHz&lt;/td&gt;
      &lt;td&gt;100MB&lt;/td&gt;
      &lt;td&gt;105W&lt;/td&gt;
      &lt;td&gt;Zen 3&lt;/td&gt;
      &lt;td&gt;无&lt;/td&gt;
      &lt;td&gt;桌面&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;锐龙5 5600X&lt;/td&gt;
      &lt;td&gt;2020-Q4&lt;/td&gt;
      &lt;td&gt;6C/12T&lt;/td&gt;
      &lt;td&gt;7nm&lt;/td&gt;
      &lt;td&gt;3.7GHz/4.6GHz&lt;/td&gt;
      &lt;td&gt;35MB&lt;/td&gt;
      &lt;td&gt;65W&lt;/td&gt;
      &lt;td&gt;Zen 3&lt;/td&gt;
      &lt;td&gt;无&lt;/td&gt;
      &lt;td&gt;桌面&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;锐龙9 4900HS&lt;/td&gt;
      &lt;td&gt;2020-Q1&lt;/td&gt;
      &lt;td&gt;8C/16T&lt;/td&gt;
      &lt;td&gt;7nm&lt;/td&gt;
      &lt;td&gt;3.0GHz/4.3GHz&lt;/td&gt;
      &lt;td&gt;12MB&lt;/td&gt;
      &lt;td&gt;35W&lt;/td&gt;
      &lt;td&gt;Zen 2&lt;/td&gt;
      &lt;td&gt;Vega 8&lt;/td&gt;
      &lt;td&gt;移动&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;性能趋势：&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;Zen 4/Zen 5架构（2022–2025）：全面转向5nm/4nm工艺，频率突破5.8GHz，桌面旗舰缓存达80MB，移动端首次集成高性能Radeon 700M核显（如780M可流畅运行1080P游戏）。&lt;/li&gt;
      &lt;li&gt;Zen 3+/Zen 3（2020–2022）：6nm/7nm工艺优化能效，移动端续航达29小时（锐龙6000系列），桌面端3D V-Cache技术显著提升游戏性能（如5800X3D）。&lt;/li&gt;
      &lt;li&gt;Zen 2（2019–2020）：7nm初代高能效设计，移动端APU（如4900HS）首次在轻薄本实现8核性能。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;型号后缀含义：&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;HX/H：移动高性能（55W+），U：低功耗移动版（15-28W）。&lt;/li&gt;
      &lt;li&gt;X3D：3D堆叠缓存（游戏优化），G：桌面APU（内置强核显）。&lt;/li&gt;
      &lt;li&gt;X：解锁超频，非X：标准版。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;AI与未来技术：&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;锐龙8000G/8040系列首次搭载NPU（AI算力39 TOPS），支持Windows Studio特效、Adobe AI加速等100+应用。&lt;/li&gt;
      &lt;li&gt;Zen 6架构（预计2026）将升级至24核（桌面）、3nm工艺，频率或突破6GHz。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;主板大小类型&quot;&gt;主板大小类型&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;ATX主板：标准尺寸，一般为305mm×244mm&lt;/li&gt;
  &lt;li&gt;Micro-ATX主板：也称为MATX，尺寸为244mm×244mm&lt;/li&gt;
  &lt;li&gt;Mini-ITX主板：尺寸为170mm×170mm&lt;/li&gt;
  &lt;li&gt;Nano-ITX主板：更小，尺寸约为120mm×120mm&lt;/li&gt;
  &lt;li&gt;E-ATX主板：尺寸为305mm×330mm&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;u盘启动盘工具&quot;&gt;U盘启动盘工具&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.wepe.com.cn/download.html&quot;&gt;微PE工具箱下载&lt;/a&gt; [纯净版]&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.usbrun.com/&quot;&gt;U盘魔术师&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.uqidong.com/&quot;&gt;U启动&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.laomaotao.net/&quot;&gt;老毛桃&lt;/a&gt; [工具多、广告多]&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.winbaicai.com/&quot;&gt;大白菜&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.ventoy.net/cn/&quot;&gt;Ventoy&lt;/a&gt; [安装deepin]&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;硬盘启动方式&quot;&gt;硬盘启动方式&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;Legacy：传统模式&lt;/li&gt;
  &lt;li&gt;UEFI：第4代处理器及以后才支持&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;硬盘分区格式&quot;&gt;硬盘分区格式&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;MBR：老主板&lt;/li&gt;
  &lt;li&gt;GPT：需要UEFI启动方式&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;二windows激活&quot;&gt;二、Windows激活&lt;/h3&gt;

&lt;h5 id=&quot;win10系统激活&quot;&gt;Win10系统激活&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;slmgr /skms zh.us.to
slmgr /ato
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;win11系统激活&quot;&gt;Win11系统激活&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;irm https://massgrave.dev/get | iex
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;三win10关闭自动更新&quot;&gt;三、Win10关闭自动更新&lt;/h3&gt;

&lt;h4 id=&quot;方法一&quot;&gt;方法一：&lt;/h4&gt;

&lt;h5 id=&quot;servicesmsc&quot;&gt;services.msc&lt;/h5&gt;

&lt;p&gt;命令：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\Windows\system32\svchost.exe -k netsvcs -p&lt;/code&gt;&lt;/p&gt;

&lt;h5 id=&quot;regeditmsc&quot;&gt;regedit.msc&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsoSvc]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Start,把start值改成16进制，值改为“4”&lt;/p&gt;

&lt;h5 id=&quot;taskschdmsc&quot;&gt;taskschd.msc&lt;/h5&gt;

&lt;p&gt;任务计划程序库 -&amp;gt; Microsoft -&amp;gt; Windows -&amp;gt; WindowsUpdate&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.csdn.net/qq_30007885/article/details/122454589&quot;&gt;文档&lt;/a&gt;&lt;/p&gt;

&lt;h4 id=&quot;方法二&quot;&gt;方法二：&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;打开注册表&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;regedit.msc&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;找到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;右击新建DWORD(32)&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FlightSettingsMaxPauseDays&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;右击修改-十进制，填写&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3650&lt;/code&gt;，确定&lt;/li&gt;
  &lt;li&gt;然后到Windows更新中延长更新日期&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;四删除此电脑的其他图标&quot;&gt;四、删除此电脑的其他图标&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;regedit.msc&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;计算机\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;删除对应内容&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;五软件集合&quot;&gt;五、软件集合&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;图像处理
    &lt;ul&gt;
      &lt;li&gt;画图工具&lt;/li&gt;
      &lt;li&gt;PhotoShop&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;声音处理（无）&lt;/li&gt;
  &lt;li&gt;屏幕录制
    &lt;ul&gt;
      &lt;li&gt;EV录屏&lt;/li&gt;
      &lt;li&gt;联想桌面工具（可只录声音）&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;动画制作
    &lt;ul&gt;
      &lt;li&gt;微课制作：万彩动画大师（付费）&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;六浏览器神器&quot;&gt;六、浏览器神器&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;视频下载器&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;360极速浏览器：视频抓取工具。可下载今日头条视频&lt;/li&gt;
  &lt;li&gt;Edge浏览器：B站下载助手-侧边栏。可下载B站视频&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;视频速度控制&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;360极速浏览器：Global Speed&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;内容修改&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;360极速浏览器：修改HTTP请求头&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;七tim设置模板路径为其他盘的方法&quot;&gt;七、TIM设置模板路径为其他盘的方法&lt;/h3&gt;

&lt;p&gt;在公用文档下新建一个名为Tencent的文件夹，并在该文件夹下新建一个名为QQ的文件夹。&lt;br /&gt;
在QQ文件夹下新建一个名为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UserDataInfo.ini&lt;/code&gt;的文本文档，并输入以下代码：&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\Users\Public\Documents\Tencent\QQ\UserDataInfo.ini&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-conf highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[&lt;span class=&quot;n&quot;&gt;UserDataImportSet&lt;/span&gt;]
&lt;span class=&quot;n&quot;&gt;NeedImport&lt;/span&gt;=&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;OldVersion&lt;/span&gt;=
&lt;span class=&quot;n&quot;&gt;OldVerDataPathType&lt;/span&gt;=
&lt;span class=&quot;n&quot;&gt;OldVerDataPath&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;OldQQInstallPath&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;D&lt;/span&gt;:\&lt;span class=&quot;n&quot;&gt;Users&lt;/span&gt;\&lt;span class=&quot;n&quot;&gt;Tencent&lt;/span&gt;\&lt;span class=&quot;n&quot;&gt;TIM&lt;/span&gt;
[&lt;span class=&quot;n&quot;&gt;UserDataSet&lt;/span&gt;]
&lt;span class=&quot;n&quot;&gt;UserDataSavePathType&lt;/span&gt;=&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;UserDataSavePath&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;D&lt;/span&gt;:\&lt;span class=&quot;n&quot;&gt;Tencent&lt;/span&gt;\&lt;span class=&quot;n&quot;&gt;Users&lt;/span&gt;\&lt;span class=&quot;n&quot;&gt;Tencent&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Files&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;NewVersion&lt;/span&gt;=
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;八净化wps&quot;&gt;八、净化WPS&lt;/h3&gt;

&lt;h5 id=&quot;取消文件格式关联&quot;&gt;取消文件格式关联&lt;/h5&gt;

&lt;p&gt;配置和修复工具→高级→兼容设置：取消不要使用WPS打开的文件格式&lt;/p&gt;

&lt;h5 id=&quot;取消功能定制&quot;&gt;取消功能定制&lt;/h5&gt;

&lt;p&gt;配置和修复工具→高级→功能定制：关闭所有、隐藏所有、取消云文档性能优化&lt;/p&gt;

&lt;h5 id=&quot;删除更新和图片软件&quot;&gt;删除更新和图片软件&lt;/h5&gt;

&lt;p&gt;打开软件安装目录→删除update.exe、删除看图软件&lt;/p&gt;

&lt;h3 id=&quot;九驾考笔记摩托车&quot;&gt;九、驾考笔记（摩托车）&lt;/h3&gt;

&lt;h5 id=&quot;不得申请驾驶证假一吊二撤三醉五逃终身&quot;&gt;不得申请驾驶证：假一吊二撤三醉五逃终身&lt;/h5&gt;

&lt;ol&gt;
  &lt;li&gt;提供虛假资料，一年内不得再申请驾驶证。&lt;/li&gt;
  &lt;li&gt;违反交规被吊销驾驶证两年不得申请驾驶证。&lt;/li&gt;
  &lt;li&gt;欺骗贿赂被撤销驾驶证三年不得申请驾驶证。&lt;/li&gt;
  &lt;li&gt;醉酒驾驶（未犯罪）五年不得申请驾驶证。&lt;/li&gt;
  &lt;li&gt;肇事后逃逸，终身不得申请驾驶证。&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;有期徒刑&quot;&gt;有期徒刑&lt;/h5&gt;

&lt;ol&gt;
  &lt;li&gt;发生重大事故，致人重伤、死亡或者使公私财产遭受重大损失的，处三年以下有期徒刑或者拘役；&lt;/li&gt;
  &lt;li&gt;交通运输肇事后逃逸或者有其他特别恶劣情节的，处三年以上七年以下有期徒刑；&lt;/li&gt;
  &lt;li&gt;因逃逸致人死亡的，处七年以上有期徒刑；&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;扣分相关&quot;&gt;扣分相关&lt;/h5&gt;

&lt;ol&gt;
  &lt;li&gt;十二分：饮酒后驾驶机动车的；造成交通事故后逃逸；高速公路上倒车、逆行；使用其他机动车号牌；&lt;/li&gt;
  &lt;li&gt;九分：驾驶与准驾车型不符的机动车的；未悬挂机动车号牌；&lt;/li&gt;
  &lt;li&gt;六分：违反道路交通信号灯通行的；&lt;/li&gt;
  &lt;li&gt;三分：违反禁令标志、禁止标线指示的；不按规定超车、让行的，或者逆向行驶的；不按规定悬挂号牌的；&lt;/li&gt;
  &lt;li&gt;一分：不戴安全头盔的；未检车的；&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;扣证扣车相关&quot;&gt;扣证/扣车相关&lt;/h5&gt;

&lt;ol&gt;
  &lt;li&gt;驾驶人将机动车交给没有驾驶证/被扣/吊销的人驾驶的，交警依法扣留原车主驾驶证。&lt;/li&gt;
  &lt;li&gt;饮酒或者醉酒驾驶机动车。&lt;/li&gt;
  &lt;li&gt;驾驶机动车行驶超过规定时速50%的。&lt;/li&gt;
  &lt;li&gt;累计积分达十二分的；&lt;/li&gt;
  &lt;li&gt;驾驶拼装的机动车或者已达到报废标准的机动车上道路行驶的；&lt;/li&gt;
  &lt;li&gt;造成交通事故需依法追究刑事责任的；&lt;/li&gt;
  &lt;li&gt;造成交通事故后逃逸的；&lt;/li&gt;
  &lt;li&gt;扣车：使用其他车辆检验合格标志嫌疑的；&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;罚款相关&quot;&gt;罚款相关&lt;/h5&gt;

&lt;ol&gt;
  &lt;li&gt;请他人代为接受违法处罚和记分支付利益罚五万（代罚三五审三二）；&lt;/li&gt;
  &lt;li&gt;考试贿赂舞弊罚两千；&lt;/li&gt;
  &lt;li&gt;隐瞒虚假罚五百；&lt;/li&gt;
  &lt;li&gt;漏检机动车罚两百；该撤离未撤离的；&lt;/li&gt;
  &lt;li&gt;大面积图案罚两百；&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;车速相关&quot;&gt;车速相关&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;城市远比公路慢，无中心线城市30公路40，有中心线城市50公路70。&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
  &lt;li&gt;能见度小于50米的，最高车速不得超过20公里，开启雾灯、近光灯、示廓灯、后尾灯、危险报警灯，并尽快从最近的出口驶离；&lt;/li&gt;
  &lt;li&gt;能见度小于100米的，最高时速不得超过40公里，开启雾灯、近光灯、示廓灯、后尾灯、危险报警灯，并与前车保持40米以上距离；&lt;/li&gt;
  &lt;li&gt;能见度小于200米的，最高时速不得超过60公里，开启雾灯、近光灯、示廓灯、后尾灯、危险报警灯，并与前车保持100米以上距离。&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;毒品相关&quot;&gt;毒品相关&lt;/h5&gt;

&lt;ol&gt;
  &lt;li&gt;（阿片类毒品）是被滥用最早的毒品，历史悠久、地域广泛、滥用者众多。&lt;/li&gt;
  &lt;li&gt;不属于毒品的是（砒霜）。&lt;/li&gt;
  &lt;li&gt;哪些药物有可能导致成瘾（杜冷丁、复方甘草片、苯巴比妥、地西泮）。&lt;/li&gt;
  &lt;li&gt;（海洛因）化学名称叫二乙烯吗啡，呈白色粉末状，也就是人们所说的“白粉”，“白面”。&lt;/li&gt;
  &lt;li&gt;（麻醉药品）是指对中枢神经有麻醉作用，连续使用后易产生身体依赖性、能形成瘾癖的药品。&lt;/li&gt;
  &lt;li&gt;新精神活性物质又称（策划药、实验室毒品、NPS、第三代毒品）。&lt;/li&gt;
  &lt;li&gt;《禁毒法》所称的毒品，是指鸦片、海洛因、甲基苯丙胺（冰毒）、吗啡、大麻、可卡因，以及国家规定管制的其他能够使人形成瘾癖的（麻醉药品和精神药品）。&lt;/li&gt;
  &lt;li&gt;吸食、注射毒品严重破坏人的生理机能和免疫机能，引起各种并发症，最终导致（吸毒死亡）。&lt;/li&gt;
  &lt;li&gt;在民国时期，（日本）已经取代英国成为向中国输入毒品最多的国家。&lt;/li&gt;
  &lt;li&gt;我国吸毒人员吸食的毒品中，吸食最多的毒品是（合成毒品）。&lt;/li&gt;
  &lt;li&gt;被成为现代迷魂药的三唑仑是一种强效的（麻醉剂）。&lt;/li&gt;
  &lt;li&gt;海洛因在中枢神经系统主要起（抑制作用）。&lt;/li&gt;
  &lt;li&gt;海洛因的滥用方式有（口吸、鼻吸、注射）。&lt;/li&gt;
  &lt;li&gt;我国《禁毒法》明确了（预防为主），综合治理，禁种、禁制、禁贩、禁吸的禁毒方针。&lt;/li&gt;
  &lt;li&gt;申请成为禁毒志愿者的年龄要求是（18岁以上）。&lt;/li&gt;
  &lt;li&gt;在吸毒人群中初次吸毒比例最高的是（好奇心驱使）。&lt;/li&gt;
  &lt;li&gt;判断：长期服用安眠药不会使人成瘾。（错误）&lt;/li&gt;
  &lt;li&gt;判断：K粉呈白色结晶粉末状，易溶于水，可随意勾兑进饮料。（正确）&lt;/li&gt;
  &lt;li&gt;毒品的基本属性有（依赖性、耐受性、危害性、非法性）。&lt;/li&gt;
  &lt;li&gt;吸毒者具有（病人、违法者、受害者）等多重属性。（犯罪者不是）&lt;/li&gt;
  &lt;li&gt;预防毒品的三道防线是指（家庭预防、学校预防、社区预防）。（社会预防不属于）&lt;/li&gt;
  &lt;li&gt;吸毒成瘾的认识。（吸毒成瘾是之中慢性的易复发的脑疾病、反复是发病规律和病态特征的表现形式）&lt;/li&gt;
  &lt;li&gt;毒品原植物的有（罂粟、古柯树、大麻、麻黄草）。&lt;/li&gt;
  &lt;li&gt;属于鸦片类毒品的有（鸦片、吗啡、海洛因）。（冰毒不是）&lt;/li&gt;
  &lt;li&gt;吸毒者初次吸毒的诱因多种多样，如好奇、无知等，但吸毒者一旦成瘾而继续反复吸毒，其原因只有两个，即（心理依赖和生理依赖）。&lt;/li&gt;
  &lt;li&gt;《刑法》规定，对已满14周岁不满16周岁的人，贩卖毒品罪，应当（负刑事责任）。&lt;/li&gt;
  &lt;li&gt;每年的（6月26日）定为国际禁毒日。&lt;/li&gt;
  &lt;li&gt;林则徐为维护中华民族的尊严，在广州虎门海滩当众销毁了从英、美鸦片贩子手中收缴的大批鸦片，这就是历史上的虎门销烟。该事件发生在（1839年6月3日）&lt;/li&gt;
  &lt;li&gt;冰毒，即（甲基苯丙胺），外观为纯白结晶体，被吸毒犯人员俗称“冰”。&lt;/li&gt;
  &lt;li&gt;鸦片，又叫（阿片），俗称大烟，源于（罂粟植物）蒴果，其所含主要生物碱是吗啡。&lt;/li&gt;
  &lt;li&gt;不属于天然类毒品的是（甲基苯丙胺）。&lt;/li&gt;
  &lt;li&gt;鸦片、杜冷丁、冰毒、摇头丸，不能人工合成的毒品是（鸦片）；（杜冷丁、冰毒、摇头丸）是新型毒品，由人工化学合成。&lt;/li&gt;
  &lt;li&gt;可卡因、海洛因、鸦片、冰毒，成瘾性和毒副作用最强的是（冰毒）。&lt;/li&gt;
  &lt;li&gt;目前我国法律规定的毒品犯罪类型有（十二类）。&lt;/li&gt;
  &lt;li&gt;艾滋病的传播途径不包括（间接接触传播）。&lt;/li&gt;
  &lt;li&gt;根据毒品来源和生产方法不同，可将毒品分为（天然毒品、合成毒品）。&lt;/li&gt;
  &lt;li&gt;毒品起源于（植物）。&lt;/li&gt;
  &lt;li&gt;从毒品滥用的时间顺序分类，可分为传统毒品和（新型毒品）两类。&lt;/li&gt;
  &lt;li&gt;贩卖毒品负刑事责任的年龄是（满14周岁）。&lt;/li&gt;
  &lt;li&gt;属于毒品的本质特征是（非法性）。&lt;/li&gt;
  &lt;li&gt;从医学角度看，吸毒成瘾作为一种疾病，以下哪个表述正确的是（慢性的复发性的脑疾病）。&lt;/li&gt;
  &lt;li&gt;世界上第一个国际禁毒公约是（《海牙禁止鸦片公约》）。&lt;/li&gt;
  &lt;li&gt;二十世纪（50年代初到70年代末），中国获得近三十年“无毒国”美誉。&lt;/li&gt;
  &lt;li&gt;世界上三大毒品产地中的哪个不在亚洲（银三角）。在南美洲&lt;/li&gt;
  &lt;li&gt;合成毒品（安眠酮）又称海米那、眠可欣，临床上适合用于各种类型的失眠症，该药久用可成瘾，已成为国内外滥用的药物之一。&lt;/li&gt;
  &lt;li&gt;冰毒、摇头丸、海洛因、麦司卡林。下列毒品中属于抑制类毒品的是（海洛因）。&lt;/li&gt;
  &lt;li&gt;在容易接触的毒品中，有一种属于荨麻目大麻科草本植物，其主要化学成分为四氢大麻酚（THC），它被人们称为（大麻）。&lt;/li&gt;
  &lt;li&gt;长期吸食以后，情绪亢奋冲动。就算是停止复吸，戒断很久以后，都容易出现幻听、幻觉、被害妄想等精神病症状。这是（苯丙胺）类毒品的精神病态特征。&lt;/li&gt;
  &lt;li&gt;吸毒至幻包括如下种类（听幻觉、视幻觉、味幻觉、嗅幻觉）。&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;其他项&quot;&gt;其他项&lt;/h5&gt;

&lt;ol&gt;
  &lt;li&gt;夜间在道路上会车时，距离对向来车多远将远光灯改用近光灯。（150米以外）&lt;/li&gt;
  &lt;li&gt;【判断】机动车登记分为注册登记和变更登记两种。（错误，还包括转移登记、抵押登记、注销登记）&lt;/li&gt;
  &lt;li&gt;【判断】服用国家管制的精神药品可以短途驾驶机动车。（错误，相当于饮酒或使用麻醉药品）&lt;/li&gt;
  &lt;li&gt;驾驶证记载的驾驶人信息发生变化的要在多长时间内申请换证。（30日）&lt;/li&gt;
  &lt;li&gt;驾驶机动车在高速公路或者城市快速路上违法停车的，一次记9分。&lt;/li&gt;
  &lt;li&gt;抢救昏迷失去知觉的伤员需注意什么？（抢救前先检查呼吸）&lt;/li&gt;
  &lt;li&gt;在为成人做心肺复苏时，胸外按压频率是多少？（100-120次/分）&lt;/li&gt;
  &lt;li&gt;【判断】抢救或处理失血伤员，首先利用外部按压力给伤员止血。（正确）&lt;/li&gt;
  &lt;li&gt;红圈空白禁通行。&lt;/li&gt;
&lt;/ol&gt;
</content>
 </entry>
 
 <entry>
   <title>PHP常用函数总结</title>
   <link href="https://comeround.cn/article/php-function.html"/>
   <updated>2022-12-06T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/php-function</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;常用关键字：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JSON_UNESCAPED_UNICODE&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;一数组函数&quot;&gt;一、数组函数&lt;/h3&gt;

&lt;h4 id=&quot;1array_group_by&quot;&gt;（1）array_group_by&lt;/h4&gt;

&lt;p&gt;该函数需要自己添加到项目中&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cd&quot;&gt;/**
 * [array_group_by 数组分组]
 * @param  [type] $arr [二维数组]
 * @param  [type] $key [键名]
 * @return [type]      [新的二维数组]
 */&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;array_group_by&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$grouped&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$arr&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$grouped&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]][]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;func_num_args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$args&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;func_get_args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$grouped&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$key&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$parms&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;array_merge&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;array_slice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;func_num_args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()));&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$grouped&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;call_user_func_array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;array_group_by&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$parms&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$grouped&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;array_group_by&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;parent_id&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//根据父级ID分组&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$list1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//直接获取到父级ID为1的数据&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$list1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;array_group_by&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;id&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;2array_column&quot;&gt;（2）array_column&lt;/h4&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$typelist&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//获取数据库中的全部数据&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$types&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;array_column&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$typelist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;name&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;id&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//把数据做成键值对&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$name1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$types&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//获取到id=1的记录对应的name值&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$typelist&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//获取数据库中的全部数据&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$types&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;array_column&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$typelist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;name&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//把数据做成数组&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;3array_multisort&quot;&gt;（3）array_multisort&lt;/h4&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;array_multisort&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;array_column&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;age&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;SORT_DESC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;array_column&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;number&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;SORT_DESC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;array_column&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;id&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;SORT_ASC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;先按年龄从大到小排序，如果年龄相同，再根据数量从大到小排序，如果仍然相同，根据ID从小到大排序&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;4array_chunk&quot;&gt;（4）array_chunk&lt;/h4&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//获取数据库中的全部数据&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$limit&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$page&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//查询数据的页码&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$lists&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;array_chunk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$limit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//根据每100条分组&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$pagelist&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$page&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;??&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//查询对应页码的数据&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$pagelist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;5array_splice&quot;&gt;（5）array_splice&lt;/h4&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//获取数据库中的全部数据&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;array_splice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//取前面5条&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;red&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;green&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;blue&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;yellow&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;brown&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;array_slice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;blue&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;yellow&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;brown&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;6array_sum&quot;&gt;（6）array_sum&lt;/h4&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//获取数据库中的全部数据&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$total&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;array_sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;array_column&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;money&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 汇总列表的money&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;7array_key_exists&quot;&gt;（7）array_key_exists&lt;/h4&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$typelist&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//获取数据库中的全部数据&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$types&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;array_column&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$typelist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;name&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;phone&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//把数据做成键值对&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$phone&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;13000001111&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;array_key_exists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$phone&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$types&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)){&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;查到手机号的姓名为：&quot;&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$types&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$phone&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;二字符串函数&quot;&gt;二、字符串函数&lt;/h3&gt;

&lt;h4 id=&quot;1拆分数组&quot;&gt;（1）拆分数组&lt;/h4&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;100,101,102,103,104,105,106&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$nums&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;explode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;,&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//$nums[0] == 100;&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$nums&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;101&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;102&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;103&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;104&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;105&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;106&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;implode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;,&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$nums&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// $str = &quot;100,101,102,103,104,105,106&quot;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;2截取字符串&quot;&gt;（2）截取字符串&lt;/h4&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$string&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;0123456789&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$str0&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;substr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// $str0 = &quot;012&quot;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;3包含字符串&quot;&gt;（3）包含字符串&lt;/h4&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$string&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;0123456789&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;strstr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;789&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)){&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;4替换字符串&quot;&gt;（4）替换字符串&lt;/h4&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$string&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str_replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;php&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;java&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//把$string中的php换成java&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;5html标签替换&quot;&gt;（5）html标签替换&lt;/h4&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$text&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;html_entity_decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//解析&amp;amp;nbsp;等html标签&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;三json函数&quot;&gt;三、JSON函数&lt;/h3&gt;

&lt;h4 id=&quot;1json和字符串转换&quot;&gt;（1）json和字符串转换&lt;/h4&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//从数据库中查询&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$string&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;JSON_UNESCAPED_UNICODE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//数组转为json字符串（中文不乱码）&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$list&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//json字符串转为数组&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;四ip地址函数&quot;&gt;四、IP地址函数&lt;/h3&gt;

&lt;h4 id=&quot;1ipv4与数字转换&quot;&gt;（1）IPv4与数字转换&lt;/h4&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;ip2long&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;127.0.0.1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;       &lt;span class=&quot;c1&quot;&gt;//2130706433&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;ip2long&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;255.255.255.255&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//4294967295&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;long2ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;                 &lt;span class=&quot;c1&quot;&gt;//0.0.0.1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;2ipv6与数字转换&quot;&gt;（2）IPv6与数字转换&lt;/h4&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;2409:8a6a:822f:a40:3060:3060:3060:3060&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$nip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;inet_pton&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;bin2hex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$nip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//24098a6a822f0a403060306030603060&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;3获取用户真实ip&quot;&gt;（3）获取用户真实IP&lt;/h4&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cd&quot;&gt;/**
 * [ip 获取用户IP（ThinkPHP自带的函数有问题，所以自己写一个）20240622]
 * @access public
 * @param  integer   $type 返回类型 0 返回IP地址 1 返回IPV4地址数字
 * @param  boolean   $adv 是否进行高级模式获取（有可能被伪装）
 * @param  string    $httpAgentIpHeader 获取代理IP的头部
 * @return [string]      [新的IP地址]
 */&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;get_client_ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$adv&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$httpAgentIpHeader&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$type&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;nv&quot;&gt;$httpAgentIp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$httpAgentIpHeader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$adv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$httpAgentIp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$httpAgentIp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$httpAgentIp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;elseif&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;HTTP_X_FORWARDED_FOR&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$arr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;explode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;,&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;HTTP_X_FORWARDED_FOR&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$pos&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;array_search&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;unknown&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$pos&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;unset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$pos&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;trim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;current&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;elseif&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;HTTP_CLIENT_IP&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;HTTP_CLIENT_IP&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;elseif&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;REMOTE_ADDR&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;REMOTE_ADDR&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;elseif&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;isset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;REMOTE_ADDR&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;REMOTE_ADDR&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// IP地址类型&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$ip_mode&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;strpos&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;:&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;ipv4&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;ipv6&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// IP地址合法验证&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;filter_var&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;FILTER_VALIDATE_IP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;ipv4&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ip_mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;0.0.0.0&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;::&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// 如果是ipv4地址，则直接使用ip2long返回int类型ip；如果是ipv6地址，暂时不支持，直接返回0&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$long_ip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;ipv4&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ip_mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;sprintf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;%u&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;ip2long&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$long_ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Excel笔记</title>
   <link href="https://comeround.cn/article/excel-study.html"/>
   <updated>2022-09-02T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/excel-study</id>
   <content type="html">&lt;h2 id=&quot;一基础部分&quot;&gt;一、基础部分&lt;/h2&gt;

&lt;h4 id=&quot;1公式汇总&quot;&gt;（1）公式汇总&lt;/h4&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;函数名称&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;函数意义&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;函数用法&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;其他&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;FLOOR&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;基数向下取整&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;CEILING&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;基数向上取整&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;ROUNDUP&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;位数向上取整&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;ROUNDDOWN&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;位数向下取整&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;MOD&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;获取余数&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;DATEDIF&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;日期间隔&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;IF&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;单重判断&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;IFS&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;多重判断&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;MID&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;截取中间字符串&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;LOOKUP&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;字典匹配&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;VLOOKUP&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;横向匹配&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;XLOOKUP&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;复杂匹配&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;-&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h4 id=&quot;2快捷键汇总&quot;&gt;（2）快捷键汇总&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# F2                 # 编辑当前单元格
# F12                # 另存为
# Ctrl+G             # 快速定位
# Ctrl+E             # 智能填充
# Ctrl+H             # 替换
# Ctrl+PgDn          # 右侧工作表
# Alt+=              # 快速求和
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;3求和&quot;&gt;（3）求和&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=SUM()
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;4平均数&quot;&gt;（4）平均数&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=AVG()
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;5总数&quot;&gt;（5）总数&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=COUNT()
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;6条件总数&quot;&gt;（6）条件总数&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;COUNTIF(A1:A10, &quot;&amp;gt;20&quot;) #用来统计范围内的符合条件的数值量
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;7字符串截取&quot;&gt;（7）字符串截取&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;取字符串左边1个字符&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=LEFT(B34,1)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;字符串拼接&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=CONCATENATE(&quot;张三&quot;,&quot;李四&quot;) #张三李四
=A1&amp;amp;B1 #张三李四
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;二中级部分&quot;&gt;二、中级部分&lt;/h2&gt;

&lt;h4 id=&quot;1身份证数据计算&quot;&gt;（1）身份证数据计算&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;取出生日期&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=MID(A6,7,8) #522228199907201735-&amp;gt;19990720
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=MID(U2,7,4)&amp;amp;&quot;-&quot;&amp;amp;MID(U2,11,2)&amp;amp;&quot;-&quot;&amp;amp;MID(U2,13,2) #522228199907201735-&amp;gt;1999-07-20
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;计算性别&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=IF(MOD(MID(A6,17,1),2),&quot;男&quot;,&quot;女&quot;) #522228199907201735-&amp;gt;男
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;计算实际年龄&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=DATEDIF(TEXT(MID(E2,7,8),&quot;#-00-00&quot;),TODAY(),&quot;y&quot;) #522228199907201735-&amp;gt;23
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;2时间数据转换&quot;&gt;（2）时间数据转换&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;时间戳转换为标准时间格式&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=(A1+8*3600)/86400+70*365+19
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;格式为（设置单元格格式-数字-自定义-类型）&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;yyyy&quot;年&quot;mm&quot;月&quot;dd&quot;日&quot;hh&quot;时&quot;mm&quot;分&quot;ss&quot;秒&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2022/excel-time-fmt.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;3数据校验&quot;&gt;（3）数据校验&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;校验K列有没有重复值（同列查重）&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=IF(COUNTIF(A:A,A2&amp;amp;&quot;*&quot;)&amp;gt;1,&quot;重复&quot;,&quot;不重复&quot;)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;校验K列有没有重复值（异列查重）&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=IF(COUNTIF(A:A,B2&amp;amp;&quot;*&quot;)&amp;gt;0,&quot;重复&quot;,&quot;不重复&quot;)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;校验身份证号码是否正确（A2单元格）&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=IF(LEN(A2)=18,IF(RIGHT(A2,1)=&quot;X&quot;,IF(CHOOSE(MOD(SUM(LEFT(RIGHT(A2,18))*7+LEFT(RIGHT(A2,17))*9+LEFT(RIGHT(A2,16))*10+LEFT(RIGHT(A2,15))*5+LEFT(RIGHT(A2,14))*8+LEFT(RIGHT(A2,13))*4+LEFT(RIGHT(A2,12))*2+LEFT(RIGHT(A2,11))*1+LEFT(RIGHT(A2,10))*6+LEFT(RIGHT(A2,9))*3+LEFT(RIGHT(A2,8))*7+LEFT(RIGHT(A2,7))*9+LEFT(RIGHT(A2,6))*10+LEFT(RIGHT(A2,5))*5+LEFT(RIGHT(A2,4))*8+LEFT(RIGHT(A2,3))*4+LEFT(RIGHT(A2,2))*2),11)+1,1,0,&quot;X&quot;,9,8,7,6,5,4,3,2)=LEFT(RIGHT(A2,1)),&quot;正确！&quot;,&quot;出错啦！&quot;),IF(CHOOSE(MOD(SUM(LEFT(RIGHT(A2,18))*7+LEFT(RIGHT(A2,17))*9+LEFT(RIGHT(A2,16))*10+LEFT(RIGHT(A2,15))*5+LEFT(RIGHT(A2,14))*8+LEFT(RIGHT(A2,13))*4+LEFT(RIGHT(A2,12))*2+LEFT(RIGHT(A2,11))*1+LEFT(RIGHT(A2,10))*6+LEFT(RIGHT(A2,9))*3+LEFT(RIGHT(A2,8))*7+LEFT(RIGHT(A2,7))*9+LEFT(RIGHT(A2,6))*10+LEFT(RIGHT(A2,5))*5+LEFT(RIGHT(A2,4))*8+LEFT(RIGHT(A2,3))*4+LEFT(RIGHT(A2,2))*2),11)+1,1,0,&quot;X&quot;,9,8,7,6,5,4,3,2)=LEFT(RIGHT(A2,1))*1,&quot;正确！&quot;,&quot;出错啦！&quot;)),IF(LEN(A2)=15,&quot;老号，请注意！&quot;,IF(LEN(A2)=0,&quot;缺号码&quot;,&quot;位数不对！&quot;)))
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;4行数判断&quot;&gt;（4）行数判断&lt;/h4&gt;

&lt;blockquote&gt;
  &lt;p&gt;前后两人为一组&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=IF(MOD(ROW()+1,2)=1,CONCATENATE(ROW()/2,&quot;组：&quot;,B2,A2,&quot;;&quot;,B3,A3),&quot;&quot;)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2022/excel-row-group.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;思路：判断行数是奇数还是偶数，是偶数则获取下一行的信息，是奇数则为空&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4 id=&quot;5获取户主身份证号码&quot;&gt;（5）获取户主身份证号码&lt;/h4&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2023/excel-main.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;思路：当本人为户主姓名，则取户主身份证号码；当本人不是户主姓名，则取上一个人的户主的身份证号码&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4 id=&quot;6区间统计&quot;&gt;（6）区间统计&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;统计学生分数段的人数：要求10分段内统计&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;（1）基于10向下取整 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;=FLOOR(A2,10)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;（2）由大到小排序&lt;/p&gt;

&lt;p&gt;（3）分类汇总：计数&lt;/p&gt;

&lt;h4 id=&quot;7字典匹配&quot;&gt;（7）字典匹配&lt;/h4&gt;

&lt;h5 id=&quot;lookup&quot;&gt;LOOKUP&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;要求：1匹配&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;一年级&lt;/code&gt;、2匹配&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;二年级&lt;/code&gt;、3匹配&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;三年级&lt;/code&gt;…&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=LOOKUP(D2,{1,2,3,4,5},{&quot;一年级&quot;,&quot;二年级&quot;,&quot;三年级&quot;,&quot;四年级&quot;,&quot;五年级&quot;})
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;要求：60分以下为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;不及格&lt;/code&gt;、60~80分为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;及格&lt;/code&gt;、80~90分为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;良好&lt;/code&gt;、90~100分为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;优秀&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=LOOKUP(A2,{0,60,80,90,101},{&quot;不及格&quot;,&quot;及格&quot;,&quot;良好&quot;,&quot;优秀&quot;})
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2023/excel-lookup-1.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;8分数段等级匹配&quot;&gt;（8）分数段等级匹配&lt;/h4&gt;

&lt;h5 id=&quot;ifs&quot;&gt;IFS&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;要求：60分以下为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;不及格&lt;/code&gt;、60~80分为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;中&lt;/code&gt;、80~90分为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;良好&lt;/code&gt;、90~100分为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;优秀&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=IFS(A2&amp;gt;=90, &quot;优秀&quot;, A2&amp;gt;=80, &quot;良好&quot;, A2&amp;gt;=60, &quot;中&quot;, A2&amp;lt;60, &quot;不及格&quot;)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;要求：这是根据学生性别和跳远成绩自动计算分数的例子&lt;/li&gt;
&lt;/ul&gt;

&lt;pre&gt;&lt;code class=&quot;language-excel&quot;&gt;=IFS(
    D5=&quot;男&quot;, IFS(
        I5&amp;gt;=2.39, 15,
        I5&amp;gt;=2.35, 14.5,
        I5&amp;gt;=2.31, 14,
        I5&amp;gt;=2.27, 13.5,
        I5&amp;gt;=2.23, 13,
        I5&amp;gt;=2.19, 12.5,
        I5&amp;gt;=2.15, 12,
        I5&amp;gt;=2.11, 11.5,
        I5&amp;gt;=2.07, 11,
        I5&amp;gt;=2.03, 10.5,
        I5&amp;gt;=1.99, 10,
        I5&amp;gt;=1.95, 9.5,
        I5&amp;gt;=1.91, 9,
        I5&amp;gt;=1.87, 8,
        I5&amp;gt;=1.83, 7,
        I5&amp;gt;=1.79, 6,
        I5&amp;gt;=1.75, 5,
        I5&amp;gt;=1.71, 4,
        I5&amp;gt;=1.67, 3,
        I5&amp;gt;=1.63, 2,
        I5&amp;gt;=1.59, 1,
        TRUE, 0
    ),
    D5=&quot;女&quot;, IFS(
        I5&amp;gt;=1.86, 15,
        I5&amp;gt;=1.83, 14.5,
        I5&amp;gt;=1.80, 14,
        I5&amp;gt;=1.77, 13.5,
        I5&amp;gt;=1.74, 13,
        I5&amp;gt;=1.71, 12.5,
        I5&amp;gt;=1.68, 12,
        I5&amp;gt;=1.65, 11.5,
        I5&amp;gt;=1.62, 11,
        I5&amp;gt;=1.59, 10.5,
        I5&amp;gt;=1.56, 10,
        I5&amp;gt;=1.53, 9.5,
        I5&amp;gt;=1.50, 9,
        I5&amp;gt;=1.48, 8,
        I5&amp;gt;=1.46, 7,
        I5&amp;gt;=1.44, 6,
        I5&amp;gt;=1.42, 5,
        I5&amp;gt;=1.40, 4,
        I5&amp;gt;=1.38, 3,
        I5&amp;gt;=1.36, 2,
        I5&amp;gt;=1.34, 1,
        TRUE, 0
    ),
    TRUE, 0
)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;类似于分支语句（if-else）&lt;/p&gt;

&lt;h4 id=&quot;8联表查询&quot;&gt;（8）联表查询&lt;/h4&gt;

&lt;h5 id=&quot;vlookup&quot;&gt;VLOOKUP&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;内置表&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=VLOOKUP(A1,{&quot;敦寨小学&quot;,2152016547;&quot;新化小学&quot;,2152016572;&quot;亮司小学&quot;,2152016548;&quot;铜鼓小学&quot;,2152016540;&quot;龙池小学&quot;,2152016549;&quot;花桥小学&quot;,2152016545},2,0)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;联表查询&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=VLOOKUP(E2,A:B,2,0)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2023/excel-vlookup-2.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=VLOOKUP(G2,IF({0,1},A:A,D:D),2,FALSE)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2023/excel-vlookup.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h5 id=&quot;xlookup&quot;&gt;XLOOKUP&lt;/h5&gt;

&lt;p&gt;XLOOKUP是Excel中用于查找和返回数据的函数，比VLOOKUP更灵活强大&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;基本语法&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=XLOOKUP(F2, A:A, B:B, &quot;查无此人&quot;, 0)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;多条件联合查找&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;=XLOOKUP(A2&amp;amp;B2, D:D&amp;amp;E:E, F:F, &quot;查无此人&quot;, 0)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;三高级部分&quot;&gt;三、高级部分&lt;/h2&gt;

&lt;h4 id=&quot;1vba批量复制sheet表并修改内容&quot;&gt;（1）VBA批量复制sheet表，并修改内容&lt;/h4&gt;

&lt;h6 id=&quot;打开vba的快捷键是altf11&quot;&gt;打开VBA的快捷键是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Alt+F11&lt;/code&gt;&lt;/h6&gt;

&lt;blockquote&gt;
  &lt;p&gt;实现生成N个表&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-vb highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;Sub&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;CreateSheets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;To&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Worksheets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Add&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;After&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Worksheets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Worksheets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;With&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Worksheets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Worksheets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Sheet&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Worksheets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;&apos; 假设第一个Sheet的名字为Sheet1&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;With&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Next&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Sub&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;把表A复制成表B，并修改相应内容&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-vb highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;Sub&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;CopyWorksheet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;&apos; 定义要复制的工作表名称&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Dim&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;SourceSheetName&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;SourceSheetName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;（1张XX）明细表&quot;&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;&apos; 检查源工作表是否存在&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;On&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Error&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Resume&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Next&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;Set&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sourceSheet&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ThisWorkbook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sheets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SourceSheetName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;On&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Error&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;GoTo&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sourceSheet&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;Is&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Nothing&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Then&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;MsgBox&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;工作表 &quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SourceSheetName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot; 不存在!&quot;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;Exit&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Sub&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;If&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;&apos; 复制工作表并指定新的名称&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sourceSheet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Copy&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;After&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ThisWorkbook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sheets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ThisWorkbook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sheets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;ActiveSheet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;（1龙A周）明细表&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sourceSheet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Copy&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;After&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ThisWorkbook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sheets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ThisWorkbook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sheets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;ActiveSheet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;（2龙L树）明细表&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;ActiveSheet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;B6&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;龙L树&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;MsgBox&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;已将 &quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SourceSheetName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot; 复制为 Sheet2。&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Sub&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;2python复制sheet表并修改内容&quot;&gt;（2）Python复制sheet表，并修改内容&lt;/h4&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;#!/usr/bin/python
# -*- coding: UTF-8 -*-
&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;openpyxl&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 打开工作簿
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;wb&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;openpyxl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;load_workbook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;（敦寨中学）2024年综合报表培训学时统计表.xlsx&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 获取表 1
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sheet1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;模板&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 创建表 2，如果表 2 已存在会覆盖现有内容
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;wb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;copy_worksheet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sheet1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;教师姓名&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sheet2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;教师姓名&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 修改表 2 的 B6 单元格内容为“贵州”
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sheet2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;B6&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;贵州&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 保存工作簿
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;wb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;save&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;（敦寨中学）2024年综合报表培训学时统计表-处理后.xlsx&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;3拆分excel文件&quot;&gt;（3）拆分Excel文件&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;删除不为6班的行&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;openpyxl&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;load_workbook&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 加载工作簿
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;wb&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;load_workbook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;2025年秋季报名册-20250919.xlsx&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 选择要操作的工作表，这里假设选择第一个工作表，你可以根据实际情况修改
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ws&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;active&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 从最后一行开始向前遍历，这样删除行时不会影响后续行的索引，数据是从5行到1661行
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;row&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1661&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# 班级是在21列
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;cell_value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ws&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cell&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;row&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;column&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;21&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cell_value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;ws&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;delete_rows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 保存修改后的工作簿
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;wb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;save&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;2025年秋季报名册-20250919-1.xlsx&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h6 id=&quot;若以上内容满足不了你的需求建议学习python或javascript数据处理&quot;&gt;若以上内容满足不了你的需求，建议学习Python或JavaScript数据处理&lt;/h6&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/article/js-advanced-learning.html&quot;&gt;JavaScript进阶学习&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/article/pandas-apply.html&quot;&gt;Pandas数据分析&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>JavaScript之Excel导出</title>
   <link href="https://comeround.cn/article/exceljs-put.html"/>
   <updated>2022-09-01T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/exceljs-put</id>
   <content type="html">&lt;p&gt;我使用的是这三个插件&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;exceljs：制作Excel&lt;/li&gt;
  &lt;li&gt;FileSaver：导出文件&lt;/li&gt;
  &lt;li&gt;mock.js生成批量模拟数据&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;https://cdn.bootcdn.net/ajax/libs/exceljs/4.3.0/exceljs.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;https://cdn.bootcdn.net/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;https://cdn.bootcdn.net/ajax/libs/Mock.js/1.0.0/mock-min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;1生成批量数据&quot;&gt;（1）生成批量数据&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;modata&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Mock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;tableData|9999&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;
        &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@cname&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@date&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;address&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@city(true)&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;2excel的头部数据&quot;&gt;（2）Excel的头部数据&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;tableHeader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;prop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;日期&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;prop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;姓名&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;prop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;address&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;地址&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;tableData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;modata&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;tableData&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;3excel内容渲染&quot;&gt;（3）Excel内容渲染&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;workbook&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ExcelJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Workbook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;workbook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;creator&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Me&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;workbook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;lastModifiedBy&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Her&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;workbook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;created&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1985&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;workbook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;modified&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;workbook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;lastPrinted&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2016&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;27&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 创建带有红色标签颜色的工作表&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sheet&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;workbook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;addWorksheet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;MySheet&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;properties&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;tabColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;argb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;FFC0000&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}}});&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;sheet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mergeCells&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;A1:C1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;sheet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getCell&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;A1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;这是文档正标题&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;sheet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getCell&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;A1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;font&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Comic Sans MS&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;family&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;36&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;bold&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;sheet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getCell&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;A1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;alignment&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;vertical&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;middle&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;horizontal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;center&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;sheet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;columns&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;31&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;32&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;33&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 生成columns&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;columns&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;tableHeader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;columns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;label&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 生成rows&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;rows&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;tableData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;tableHeader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sub&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sub&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;prop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sub&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;prop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;rows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;sheet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;addTable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;MyTestTable&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;ref&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;A2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 表格左上角的位置&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;headerRow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;totalsRow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;theme&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;TableStyleLight1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;showRowStripes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//单双行&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;columns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;columns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;rows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;rows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;4渲染excel并导出&quot;&gt;（4）渲染Excel并导出&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;workbook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;xlsx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;writeBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;buffer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;saveAs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Blob&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;application/octet-stream&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}),&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;表格导出.xlsx&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h6 id=&quot;运行效果&quot;&gt;运行效果&lt;/h6&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2022/exceljs.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://cdn.fe80.cn/web/demo/exceljs.html&quot;&gt;点我查看效果&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h6 id=&quot;源代码分享&quot;&gt;源代码分享&lt;/h6&gt;

&lt;ul&gt;
  &lt;li&gt;https://github.com/linzening/code/blob/main/html/exceljs.html&lt;/li&gt;
&lt;/ul&gt;

&lt;h6 id=&quot;参考文档&quot;&gt;参考文档&lt;/h6&gt;

&lt;ul&gt;
  &lt;li&gt;https://www.jianshu.com/p/fc96e22c4df1&lt;/li&gt;
  &lt;li&gt;https://github.com/exceljs/exceljs/blob/master/README_zh.md&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>应用层协议</title>
   <link href="https://comeround.cn/article/osi-7.html"/>
   <updated>2022-08-29T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/osi-7</id>
   <content type="html">&lt;h2 id=&quot;一osi基础知识&quot;&gt;一、OSI基础知识&lt;/h2&gt;

&lt;h3 id=&quot;1osi-网络七层模型&quot;&gt;（1）OSI 网络七层模型&lt;/h3&gt;

&lt;p&gt;第一层：应用层，定义了用于在网络中进行通信和传输数据的接口；（Http协议位于该层）&lt;/p&gt;

&lt;p&gt;第二层：表示层，定义不同系统中数据的传输格式，编码和解码规范等；&lt;/p&gt;

&lt;p&gt;第三层：会话层，管理用户的会话，控制用户间逻辑连接的建立和中断；&lt;/p&gt;

&lt;p&gt;第四层：传输层，管理着网络中端到端的数据传输；（Tcp协议位于该层）&lt;/p&gt;

&lt;p&gt;第五层：网络层，定义网络设备间如何传输数据；（IP位于该层）&lt;/p&gt;

&lt;p&gt;第六层：链路层，将上面的网络层的数据包封装成数据帧，便于物理层传输；&lt;/p&gt;

&lt;p&gt;第七层：物理层，这一层主要就是传输这些二进制数据。&lt;/p&gt;

&lt;h3 id=&quot;2tcp连接&quot;&gt;（2）TCP连接&lt;/h3&gt;

&lt;p&gt;建立起一个TCP连接需要经过“三次握手”：&lt;/p&gt;

&lt;p&gt;第一次握手：客户端发送syn包(syn=j)到服务器，并进入SYN_SEND状态，等待服务器确认；&lt;/p&gt;

&lt;p&gt;第二次握手：服务器收到syn包，必须确认客户的SYN（ack=j+1），同时自己也发送一个SYN包（syn=k），即SYN+ACK包，此时服务器进入SYN_RECV状态；&lt;/p&gt;

&lt;p&gt;第三次握手：客户端收到服务器的SYN＋ACK包，向服务器发送确认包ACK(ack=k+1)，此包发送完毕，客户端和服务器进入ESTABLISHED状态，完成三次握手。&lt;/p&gt;

&lt;p&gt;握手过程中传送的包里不包含数据，三次握手完毕后，客户端与服务器才正式开始传送数据。理想状态下，TCP连接一旦建立，在通信双方中的任何一方主动关闭连接之前，TCP 连接都将被一直保持下去。断开连接时服务器和客户端均可以主动发起断开TCP连接的请求。&lt;/p&gt;

&lt;p&gt;SYN攻击就是利用三次握手的第二次握手时进行的，这时候服务器处于SYN_RECV状态，等待客户端进行确认ACK，SYN会伪造不存在的源IP，就会有大量的链接处于等待或重试发送SYN+ACK包，导致该阶段队列持续增长，进而导致后续正常请求被丢弃。&lt;/p&gt;

&lt;h2 id=&quot;二应用层协议&quot;&gt;二、应用层协议&lt;/h2&gt;

&lt;p&gt;HTTP、DNS&lt;/p&gt;

&lt;h3 id=&quot;1http&quot;&gt;（1）HTTP&lt;/h3&gt;

&lt;p&gt;HTTP协议即超文本传送协议(Hypertext Transfer Protocol )，是Web联网的基础，也是手机联网常用的协议之一，HTTP协议是建立在TCP协议之上的一种应用。&lt;/p&gt;

&lt;p&gt;HTTP连接最显著的特点是客户端发送的每次请求都需要服务器回送响应，在请求结束后，会主动释放连接。从建立连接到关闭连接的过程称为“一次连接”。&lt;/p&gt;

&lt;p&gt;在HTTP 1.0中，客户端的每次请求都要求建立一次单独的连接，在处理完本次请求后，就自动释放连接。
在HTTP 1.1中，则可以在一次连接中处理多个请求，并且多个请求可以重叠进行，不需要等待一个请求结束后再发送下一个请求。
由于HTTP在每次请求结束后都会主动释放连接，因此HTTP连接是一种“短连接”。&lt;/p&gt;

&lt;p&gt;要保持客户端程序的在线状态，需要不断地向服务器发起连接请求，通常情况下即使不需要获得任何数据，客户端也保持每隔一段固定的时间向服务器发送一次“保持连接”的请求，服务器在收到该请求后对客户端进行回复，表明知道客户端“在线”。若服务器长时间无法收到客户端的请求，则认为客户端“下线”，若客户端长时间无法收到服务器的回复，则认为网络已经断开。&lt;/p&gt;

&lt;h4 id=&quot;http之缓存&quot;&gt;HTTP之缓存&lt;/h4&gt;

&lt;p&gt;第一层为强缓存：Cache-Control与Expires，即Cache-Control的优先级最高，直接从本地缓存获取，不需要返回服务器验证；&lt;/p&gt;

&lt;p&gt;第二层为协商缓存：Last-Modified与Etag，需要返回服务器验证，返回304；&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Date：当前请求的时间&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Date: Tue, 30 Aug 2022 06:05:23 GMT&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;HTTP/1.0中 Expires，直接设置过期时间&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Expires:Fri, 10 Apr 2022 16:30:04 GMT&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Cache-Control：请求缓存后的多少秒不再发起请求，需要和Date对比，响应200(来自内存缓存)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Cache-Control: max-age=864000&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Last-Modified：资源最新修改时间&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Last-Modified: Thu, 25 Aug 2022 02:18:43 GMT&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;ETag：资源内容唯一标识&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ETag: &quot;067CBE6331580D9947617F54F7EC8F3B&quot;&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;If-None-Match：请求头，把ETag再带回去，由服务器做对比&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;If-None-Match: 58b66ccbe349d0d931df877c00d8101d037243dc&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;If-Modified-Since：请求头，把Last-Modified带回去做对比&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;If-Modified-Since: Tue, 30 Aug 2022 05:49:48 GMT&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;请求头&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,ja;q=0.7,mt;q=0.6
Connection: keep-alive
Host: doc.comeround.cn
If-Modified-Since: Tue, 30 Aug 2022 05:49:48 GMT
If-None-Match: &quot;03202C42A908FC6A9D2A56CE81CF6777&quot;
Referer: http://comeround.cn/
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;响应头&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;状态代码: 304 Not Modified
Accept-Ranges: bytes
Content-Length: 478
Content-MD5: AyAsQqkI/GqdKlbOgc9ndw==
Content-Type: application/octet-stream
Date: Tue, 30 Aug 2022 06:16:12 GMT
ETag: &quot;03202C42A908FC6A9D2A56CE81CF6777&quot;
Last-Modified: Tue, 30 Aug 2022 05:49:48 GMT
Server: AliyunOSS
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2022/osi-http-cache.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;2websocket&quot;&gt;（2）Websocket&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;WebSocket 握手&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;当客户端想要使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebSocket&lt;/code&gt;协议与服务端进行通信时, 首先需要确定服务端是否支持&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebSocket&lt;/code&gt;协议, 因此&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebSocket&lt;/code&gt;协议的第一步是进行握手, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebSocket&lt;/code&gt;握手采用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HTTP Upgrade&lt;/code&gt;机制, 客户端可以发送如下所示的结构发起握手 (请注意&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebSocket&lt;/code&gt;握手只允许使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HTTP GET&lt;/code&gt;方法):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;GET /chat HTTP/1.1
Host: server.comeround.cn
Upgrade: websocket
Connection: Upgrade
Origin: http://example.com
Sec-WebSocket-Protocol: chat, superchat
Sec-WebSocket-Version: 13
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HTTP Header&lt;/code&gt;中设置&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Upgrade&lt;/code&gt;字段, 其字段值为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;websocket&lt;/code&gt;, 并在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Connection&lt;/code&gt;字段指示&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Upgrade&lt;/code&gt;, 服务端若支持&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebSocket&lt;/code&gt;协议, 并同意握手, 可以返回如下所示的结构:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
Sec-WebSocket-Protocol: chat
Sec-WebSocket-Version: 13
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;3dns&quot;&gt;（3）DNS&lt;/h3&gt;

&lt;h4 id=&quot;a记录的域名的解析过程&quot;&gt;A记录的域名的解析过程&lt;/h4&gt;

&lt;p&gt;查寻根域名服务器，获得com服务器的NS记录的IP&lt;/p&gt;

&lt;p&gt;查寻com服务器，获得a.com域名的NS记录的IP&lt;/p&gt;

&lt;p&gt;查询a.a.com的A记录，获得IP&lt;/p&gt;

&lt;h4 id=&quot;cname记录域名的解析过程&quot;&gt;CNAME记录域名的解析过程&lt;/h4&gt;

&lt;p&gt;例如：a.a.com域名的cname为b.b.com，b.b.com的A记录为2408:4000::1&lt;/p&gt;

&lt;h3 id=&quot;4https的认证过程&quot;&gt;（4）HTTPS的认证过程&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;获取非对称公钥&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;认证非对称公钥和域名&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;获取随机码（由服务端提供）&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;计算对称密钥（通过随机码计算得到）&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;使用对称密钥加密并传输信息&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>我用Latex写公式</title>
   <link href="https://comeround.cn/article/latex-math.html"/>
   <updated>2022-08-24T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/latex-math</id>
   <content type="html">&lt;script id=&quot;MathJax-script&quot; async=&quot;&quot; src=&quot;https://mirror.fe80.cn/mathjax/3.2.2/es5/tex-mml-chtml.js&quot;&gt;&lt;/script&gt;

&lt;script type=&quot;text/x-mathjax-config&quot;&gt;
  MathJax = {
    tex: {
      inlineMath: [[&apos;$&apos;, &apos;$&apos;], [&apos;\\(&apos;, &apos;\\)&apos;]]
    }
  };
&lt;/script&gt;

&lt;p style=&quot;margin-top: 10px; padding: 3px; max-width: 100%; border-radius: 20px; border-width: 1px; border-style: dashed; border-color: rgb(215, 142, 122); color: rgb(6, 6, 6); text-align: center; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt; 上学学过的那些公式，你不会这么快就忘了吧？&lt;style&gt;.post&gt;div&gt;p{text-indent:2em;margin-bottom: 5px;}&lt;/style&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;公式请到这里写 &lt;a href=&quot;https://latexlive.com/home&quot;&gt;latexlive&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div style=&quot;background-color:rgba(197, 227, 211, 0.34);margin-bottom:10px;&quot;&gt;
	&lt;span style=&quot;display: inline-block;
    width: 50px;
    height: 50px;
    vertical-align: top;
    overflow: hidden;
    border-radius: 0% 100px 100px 0%;
    border-width: 0px;
    border-style: none;
    border-color: rgb(62, 62, 62);
    background-color: rgb(111, 186, 131);color:#fff;
	font-weight:600;
	padding:12px;&quot;&gt;
01
	&lt;/span&gt;
	&lt;span style=&quot;color:rgb(83, 118, 105);padding:8px;display:inline-block;font-size:20px;&quot;&gt;
		初中数学公式
	&lt;/span&gt;
&lt;/div&gt;

&lt;h3 id=&quot;平方差公式&quot;&gt;平方差公式&lt;/h3&gt;

\[(a+b)(a-b)=a^2-b^2\]

&lt;h3 id=&quot;完全平方公式&quot;&gt;完全平方公式&lt;/h3&gt;

\[(a±b)^2=a^2±2ab+b^2\]

\[a^2+b^2=(a+b)^2-2ab\]

\[a^3+b^3=(a+b)(a^2-ab+b^2)\]

\[(a+b)^3=a^3+3a^2b+3ab^2+b^3\]

\[(a+b+c)^2=a^2+b^2+c^2+2ab+2ac+2bc\]

\[ab=\frac{(a+b)^2-(a^2+b^2)}{2}=\frac{(a+b)^2-(a-b)^2}{4}\]

&lt;h3 id=&quot;一次函数&quot;&gt;一次函数&lt;/h3&gt;

&lt;p&gt;系数K（斜率）&lt;/p&gt;

\[k=\frac{y_1-y_2}{x_1-x_2}\]

&lt;div style=&quot;background-color:rgba(197, 227, 211, 0.34);margin-bottom:10px;&quot;&gt;
	&lt;span style=&quot;display: inline-block;
    width: 50px;
    height: 50px;
    vertical-align: top;
    overflow: hidden;
    border-radius: 0% 100px 100px 0%;
    border-width: 0px;
    border-style: none;
    border-color: rgb(62, 62, 62);
    background-color: rgb(111, 186, 131);color:#fff;
	font-weight:600;
	padding:12px;&quot;&gt;
02
	&lt;/span&gt;
	&lt;span style=&quot;color:rgb(83, 118, 105);padding:8px;display:inline-block;font-size:20px;&quot;&gt;
		高中数学与高等数学公式
	&lt;/span&gt;
&lt;/div&gt;

&lt;h3 id=&quot;勾股定理&quot;&gt;勾股定理&lt;/h3&gt;

\[a^2+b^2=c^2\]

&lt;h3 id=&quot;圆的标准方程&quot;&gt;圆的标准方程&lt;/h3&gt;

\[(x-a)^2+(y-b)^2=r^2\]

&lt;h3 id=&quot;球的体积公式&quot;&gt;球的体积公式&lt;/h3&gt;

\[V_球=\frac{4\pi r^3}{3}, (r为半径)\]

&lt;h3 id=&quot;球的表面积公式&quot;&gt;球的表面积公式&lt;/h3&gt;

\[S_球=4\pi r^2, (r为半径)\]

&lt;h3 id=&quot;指数&quot;&gt;指数&lt;/h3&gt;

\[a^{m+n}=a^m \cdot a^n \tag{1}\]

\[a^{m-n}=\frac{a^m}{a^n} \tag{2}\]

\[(ab)^{n}=a^n \cdot b^n \tag{3}\]

\[a^{\frac{m}{n}}=\sqrt[n]{a^m} \tag{4}\]

&lt;h3 id=&quot;对数&quot;&gt;对数&lt;/h3&gt;

\[a^N = b \Rightarrow \log_{a}{b} = N \tag{1}\]

\[\log_a(MN) = \log_aM + \log_aN \tag{2}\]

\[\log_a(\frac{M}{N}) = \log_aM - \log_aN \tag{3}\]

\[\log_a N = \frac{\log_bN}{\log_ba} (b&amp;gt;0,b\neq1)  \tag{4}\]

\[\log_a M^n = n \cdot \log_a M \tag{5}\]

\[\log_{a^n} M = \frac{1}{n} \cdot \log_a M \tag{6}\]

&lt;h3 id=&quot;三角函数常用值&quot;&gt;三角函数常用值&lt;/h3&gt;

\[\sin 30 ° = \frac{1}{2},\sin45 °=\frac{\sqrt{2}}{2},\sin60 °=\frac{\sqrt{3}}{2} \tag{1}\]

\[\cos 30 ° = \frac{\sqrt{3}}{2},\cos 45 °=\frac{\sqrt{2}}{2},\cos 60 °=\frac{1}{2} \tag{2}\]

\[\tan 30 ° = \sqrt{3},\cos 45 °=1,\cos 60 °=\frac{\sqrt{3}}{3} \tag{3}\]

&lt;h3 id=&quot;三角函数&quot;&gt;三角函数&lt;/h3&gt;

\[\tan x = \frac{\sin x}{\cos x},\cot x = \frac{\cos x}{\sin x}\]

&lt;h3 id=&quot;反三角函数&quot;&gt;反三角函数&lt;/h3&gt;

\[y=\sin x,x=\arcsin y\]

\[y=\cos x,x=\arccos y\]

&lt;h3 id=&quot;抛物线方程&quot;&gt;抛物线方程&lt;/h3&gt;

\[y = ax^2 + bx + c\]

&lt;ul&gt;
  &lt;li&gt;与x轴的交点&lt;/li&gt;
&lt;/ul&gt;

\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}\]

&lt;h3 id=&quot;直线方程&quot;&gt;直线方程&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;一般式&lt;/li&gt;
&lt;/ul&gt;

\[Ax + By + c = 0\]

&lt;ul&gt;
  &lt;li&gt;斜截式&lt;/li&gt;
&lt;/ul&gt;

\[y=kx+b\]

&lt;ul&gt;
  &lt;li&gt;点斜式&lt;/li&gt;
&lt;/ul&gt;

\[y-y_1=k(x-x_1)\]

&lt;ul&gt;
  &lt;li&gt;两点式&lt;/li&gt;
&lt;/ul&gt;

\[\frac{y-y_1}{y_2-y_1}=\frac{x-x_1}{x_2-x_1}\]

&lt;ul&gt;
  &lt;li&gt;截距式&lt;/li&gt;
&lt;/ul&gt;

\[\frac{x}{a} + \frac{y}{b} = 1\]

&lt;h3 id=&quot;三角和差公式&quot;&gt;三角和差公式&lt;/h3&gt;

\[\sin(\alpha+\beta) = \sin \alpha \cos \beta + \cos\alpha\sin\beta\]

\[\sin(\alpha-\beta) = \sin \alpha \cos \beta - \cos\alpha\sin\beta\]

\[\cos(\alpha+\beta) = \cos \alpha \cos \beta - \sin\alpha\sin\beta\]

\[\cos(\alpha-\beta) = \cos \alpha \cos \beta + \sin\alpha\sin\beta\]

\[\sin \alpha + \sin \beta =2 \sin \frac{\alpha + \beta}{2}\cos \frac{\alpha - \beta}{2}\]

&lt;h3 id=&quot;倍角公式&quot;&gt;倍角公式&lt;/h3&gt;

\[\sin2\alpha=2\sin\alpha\cos\beta\]

\[\cos2\alpha=2\cos \alpha^2-1=1-2\sin^2\alpha=cos^2\alpha-\sin^2\alpha\]

\[\tan 2\alpha=\frac{2\tan\alpha}{1-\tan^2\alpha}\]

&lt;h3 id=&quot;微分公式求导公式&quot;&gt;微分公式（求导公式）&lt;/h3&gt;

\[(c)^\prime = 0,(c为常数) \tag{1}\]

\[(a^x)^\prime = a^x \ln a \tag{2}\]

\[(e^x)^\prime = e^x \tag{3}\]

\[(x^n)^\prime = nx^{n-1} \tag{4}\]

\[(\log_ax)^\prime = \frac{1}{x\ln a} \tag{5}\]

\[(\ln x)^\prime = \frac{1}{x} \tag{6}\]

\[(\sin x)^\prime = \cos x \tag{7}\]

\[(\cos x)^\prime = -\sin x \tag{8}\]

\[(\tan x)^\prime = \frac{1}{\cos^2x} = \sec^2x \tag{9}\]

\[(\arcsin x)^\prime = \frac{1}{\sqrt{1-x^2}} \tag{10}\]

\[(\cot x)^\prime = -\frac{1}{\sin^2x} \tag{11}\]

\[(uv)^\prime=u^\prime \cdot v + u \cdot v^\prime \tag{12}\]

&lt;h3 id=&quot;常用积分公式&quot;&gt;常用积分公式&lt;/h3&gt;

\[\int k\mathrm{d}x = kx+C \tag{1}\]

\[\int x^\mu \mathrm{d}x = \frac{x^{\mu+1}}{\mu+1}+C \tag{2}\]

\[\int \frac{1}{x}\mathrm{d}x= \ln \left| x \right| +C  \tag{3}\]

\[\int \frac{1}{1+x^{2}}\mathrm{d}x= \arctan x +C \tag{4}\]

\[\int \frac{1}{\sqrt{1-x^{2}}}\mathrm{d}x= \arcsin x +C \tag{5}\]

\[\int \cos x \mathrm{d}x= \sin x +C \tag{6}\]

\[\int \sin x \mathrm{d}x= -\cos x +C \tag{7}\]

\[\int \frac{1}{\cos^2x} \mathrm{d}x= \tan x +C \tag{8}\]

\[\int \frac{1}{\sin^2x} \mathrm{d}x= -\cot x +C \tag{9}\]

\[\int \sec x \tan x \mathrm{d}x= \sec x +C \tag{10}\]

\[\int \csc x \cot x \mathrm{d}x= -\csc x +C \tag{11}\]

\[\int e^x \mathrm{d}x= e^x +C \tag{12}\]

\[\int a^x \mathrm{d}x= \frac{a^x}{\ln a} +C \tag{13}\]

\[\int sh x \mathrm{d}x= ch x +C \tag{14}\]

\[\int ch x \mathrm{d}x= sh x +C \tag{15}\]

&lt;h3 id=&quot;不定积分&quot;&gt;不定积分&lt;/h3&gt;

\[\int f(x)\mathrm{d}x = F(x) + c\]

&lt;h3 id=&quot;牛顿-莱布尼兹公式&quot;&gt;牛顿-莱布尼兹公式&lt;/h3&gt;

&lt;p&gt;如果函数(f(x))在区间([a,b])上连续，并且存在原函数(F(x))，则&lt;/p&gt;

\[\int_a^b f(x)\mathrm{d}x = F(b)-F(a)=F(x)|_a^b\]

&lt;h3 id=&quot;齐次方程公式&quot;&gt;齐次方程公式&lt;/h3&gt;

\[{ dy \over dx} = u + x { du \over dx}\]

&lt;h3 id=&quot;三角函数积分&quot;&gt;三角函数积分&lt;/h3&gt;

\[\sin x = { 2u \over 1 + u^ 2}\]

\[\cos x = { 1-u^2 \over 1 + u^ 2}\]

&lt;h3 id=&quot;全微分公式&quot;&gt;全微分公式&lt;/h3&gt;

\[dz = {{\partial z} \over {\partial x}}dx + { {\partial z} \over {\partial y}}dy\]

\[du = {{\partial u} \over {\partial x}}dx + { {\partial u} \over {\partial y}}dy + { {\partial u} \over {\partial z}}dz\]

&lt;h3 id=&quot;两个重要极限&quot;&gt;两个重要极限&lt;/h3&gt;

\[\lim_{x \to 0} \frac{\sin x}{x}=1 \tag{1}\]

\[\lim_{x \to \infty}  (1+\frac{1}{x} )^x = e \tag{2}\]

&lt;h3 id=&quot;常用极限&quot;&gt;常用极限&lt;/h3&gt;

\[\lim_{x \to \infty} \sqrt[x]{a} = 1\]

\[\lim_{x \to \infty} \sqrt[x]{x} = 1\]

&lt;h3 id=&quot;分部积分法&quot;&gt;分部积分法&lt;/h3&gt;

\[\int u \frac{\mathrm{d}v}{\mathrm{d}x}\,\mathrm{d}x=uv-\int \frac{\mathrm{d}u}{\mathrm{d}x}v\,\mathrm{d}x\]

\[\int u \mathrm{d}v = u \cdot v - \int v \mathrm{d}u\]

&lt;h3 id=&quot;旋转体的体积计算&quot;&gt;旋转体的体积计算&lt;/h3&gt;

\[\int \pi f^2(x) \mathrm{d}x\]

&lt;h3 id=&quot;二重积分&quot;&gt;二重积分&lt;/h3&gt;

\[\iint_{a}^{b} f(x,y) \mathrm{d}x \mathrm{d}y\]

\[\int_{0}^{1} \mathrm{d}y \int_{0}^{1} f(x,y) \mathrm{d}x\]

\[\iint\limits_D dx\,dy\]

&lt;h3 id=&quot;常数项级数&quot;&gt;常数项级数&lt;/h3&gt;

\[\sum_{n=1}^{\infty}{u_n}\]

&lt;h3 id=&quot;等比级数调和级数p级数&quot;&gt;等比级数、调和级数、P级数&lt;/h3&gt;

&lt;h3 id=&quot;幂级数&quot;&gt;幂级数&lt;/h3&gt;

\[a_0+a_1x+a_2x^2+\cdots+a_nx^n+\cdots= \sum_{n=1}^{\infty}{a_nx^n}\]

&lt;h4 id=&quot;收敛半径&quot;&gt;收敛半径&lt;/h4&gt;

\[R=\frac{1}{\rho}=\frac{u_{n+1}}{u_n}\]

\[\rho= \lim_{n \to +\infty}|\frac{a_{n+1}}{a_n}|\]

&lt;h3 id=&quot;傅里叶级数&quot;&gt;傅里叶级数&lt;/h3&gt;

&lt;h3 id=&quot;行列式计算&quot;&gt;行列式计算&lt;/h3&gt;

\[\begin{vmatrix}
1  &amp;amp; 2 &amp;amp; 3\\
4  &amp;amp; 5 &amp;amp; 6\\
7  &amp;amp; 8 &amp;amp;9
\end{vmatrix}=1×5×9+2×6×7+3×4×8-(3×5×7+2×4×9+6×8×1)=n\]

&lt;h3 id=&quot;矩阵&quot;&gt;矩阵&lt;/h3&gt;

\[\begin{bmatrix}
 1 &amp;amp; 2 &amp;amp; 3\\
 4 &amp;amp; 5 &amp;amp; 6\\
 7 &amp;amp; 8 &amp;amp;9
\end{bmatrix}\]

&lt;h3 id=&quot;排列组合公式&quot;&gt;排列组合公式&lt;/h3&gt;

\[\mathrm{A}_n^m=\frac{n!}{(n-m)!} \tag{排列公式}\]

\[\mathrm{C}_n^m=\mathrm{C}_n^{n-m}=\frac{A_n^m}{m!} \tag{组合公式}\]

&lt;h3 id=&quot;二项式系数&quot;&gt;二项式系数&lt;/h3&gt;

\[\dbinom{n}{r}=\binom{n}{n-r}=\mathrm{C}_n^r=\mathrm{C}_n^{n-r}\]

&lt;h3 id=&quot;齐次线性方程组&quot;&gt;齐次线性方程组&lt;/h3&gt;

\[\begin{cases}
3x + 5y +  z \\
7x - 2y + 4z \\
-6x + 3y + 2z
\end{cases}\]

\[\left\{\begin{aligned}
3x + 5y +  z \\
7x - 2y + 4z \\
-6x + 3y + 2z
\end{aligned}\right.\]

\[f(x)=\begin{cases} 
		1, &amp;amp; x&amp;gt;0\\ 
		0, &amp;amp; x=0\\
		-1, &amp;amp; x&amp;lt;0
\end{cases}\]

&lt;h3 id=&quot;等差数列公式&quot;&gt;等差数列公式&lt;/h3&gt;

\[a_{n}=a_{1}+ \left( n-1 \left) d\right. \right.\]

&lt;h3 id=&quot;等差数列的前n项和&quot;&gt;等差数列的前N项和&lt;/h3&gt;

\[S_{n}=\frac{n \left( a_{1}+a_{n}\right)}{2}=na_{1}+\frac{n \left( n-1 \right)}{{2}}d\]

&lt;h3 id=&quot;等比数列公式&quot;&gt;等比数列公式&lt;/h3&gt;

\[a_{n}=a_{1}q^{n-1}\]

&lt;h3 id=&quot;等比数列的前n项和&quot;&gt;等比数列的前N项和&lt;/h3&gt;

\[S_{n}=\frac{a_1(1-q^n)}{1-q}=\frac{a_1+a_nq}{1-q}\]

&lt;h3 id=&quot;等差中项&quot;&gt;等差中项&lt;/h3&gt;

\[2b=a+c,(a,b,c为等差数列)\]

&lt;h3 id=&quot;等比中项&quot;&gt;等比中项&lt;/h3&gt;

\[b^2=a \cdot c,(a,b,c为等比数列)\]

&lt;h3 id=&quot;裂项相消法&quot;&gt;裂项相消法&lt;/h3&gt;

\[若 \frac{1}{n(n+1)}=\frac{1}{n}-\frac{1}{n+1},则有T_n=1-\frac{1}{n+1}=\frac{n}{n+1} \tag{1}\]

&lt;h3 id=&quot;二项式定理&quot;&gt;二项式定理&lt;/h3&gt;

\[(a+b)^n=C_{n}^{0}a^n+C_{n}^{1}a^{n-1}b^1+C_{n}^{2}a^{n-2}b^2+\cdots+C_{n}^{k}a^{n-k}b^k+\cdots+C_{n}^{n}b^n\]

\[(a+b)^n=\sum_{r=0}^{n}{C_{n}^{r}a^{n-r}b^r}\]

&lt;h3 id=&quot;二项展开式的通项&quot;&gt;二项展开式的通项&lt;/h3&gt;

\[T_{r+1}=C_{n}^{r}a^{n-r}b^r\]

&lt;h3 id=&quot;两点之间的距离公式&quot;&gt;两点之间的距离公式&lt;/h3&gt;

\[|AB| = \sqrt{(x_1-x_2)^2+(y_1-y_2)^2+(z_1-z_2)^2}\]

&lt;h3 id=&quot;平面方程&quot;&gt;平面方程&lt;/h3&gt;

\[Ax+By+Cz+D=0\]

&lt;h3 id=&quot;平面的点法式方程&quot;&gt;平面的点法式方程&lt;/h3&gt;

\[A(x-x_0)+B(y-y_0)+C(z-z_0)=0\]

&lt;ul&gt;
  &lt;li&gt;法向量\(\vec{n}={A,B,C}\)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;直线与平面的夹角&quot;&gt;直线与平面的夹角&lt;/h3&gt;

\[\sin \theta=\frac{Al+Bm+Cn}{\sqrt{A^2+B^2+C^2} \cdot \sqrt{l^2+m^2+n^2}}\]

&lt;h3 id=&quot;两平面的夹角&quot;&gt;两平面的夹角&lt;/h3&gt;

\[\cos \theta=\frac{A_1A_2+B_1B_2+C_1C_2}{\sqrt{A_1^2+B_1^2+C_1^2} \cdot \sqrt{A_2^2+B_2^2+C_2^2}}\]

&lt;h3 id=&quot;点到平面的距离公式&quot;&gt;点到平面的距离公式&lt;/h3&gt;

\[d=\frac{|Ax_0+By_0+Cz_0+D|}{\sqrt{A^2+B^2+C^2}}\]

&lt;h3 id=&quot;点到直线的距离&quot;&gt;点到直线的距离&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;点：\(M(x_0,y_0,z_0)\)&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;直线\({L_1：\frac{x-x_1}{l_1}=\frac{y-y_1}{m_1}=\frac{z-z_1}{n_1}}\)&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

\[d=未写\]

&lt;h3 id=&quot;椭圆和双曲线&quot;&gt;椭圆和双曲线&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;椭圆公式：a&amp;gt;0,b&amp;gt;0&lt;/li&gt;
&lt;/ul&gt;

\[\frac{x^{2}}{a^{2}}+\frac{y^{2}}{b^{2}}=1\]

&lt;ul&gt;
  &lt;li&gt;双曲线公式：a&amp;gt;0,b&amp;gt;0&lt;/li&gt;
&lt;/ul&gt;

\[\frac{x^{2}}{a^{2}}-\frac{y^{2}}{b^{2}}=1\]

&lt;h3 id=&quot;极坐标公式&quot;&gt;极坐标公式&lt;/h3&gt;

&lt;p&gt;在极坐标中，\( \rho \)表示长度，取值范围[0,+∞)，\( \theta \)表示角度，取值范围[0,2π)或[-π,π]&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;基本转换公式&lt;/li&gt;
&lt;/ul&gt;

\[\left\{\begin{matrix} 
  x= \rho \text{cos}\theta \\  
  y= \rho \text{sin}\theta 
\end{matrix}\right.\]

&lt;ul&gt;
  &lt;li&gt;直线表达式：直角坐标系中点(1,0)到(0,1)的直线&lt;/li&gt;
&lt;/ul&gt;

\[\rho = \frac{1}{ \sin \theta + \cos \theta}\]

&lt;ul&gt;
  &lt;li&gt;圆的参数方程：\( \rho \) 为长度，大于0，\( \theta \) 为角度，[0,2π)&lt;/li&gt;
&lt;/ul&gt;

\[\left\{\begin{matrix} 
  x=a + r\text{cos}\theta \\  
  y=b + r\text{sin}\theta 
\end{matrix}\right. \tag{圆的参数方程}\]

&lt;h3 id=&quot;概率的五个计算公式&quot;&gt;概率的五个计算公式&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;加法公式：对任意两个事件A与B，有&lt;/li&gt;
&lt;/ul&gt;

\[P(A \cup B)=P(A)+P(B) - P(A \cap B)\]

&lt;ul&gt;
  &lt;li&gt;减法公式：对任意两个事件A与B，有&lt;/li&gt;
&lt;/ul&gt;

\[P(A - B)=P(A\bar{B})= P(A) - P(AB)\]

&lt;ul&gt;
  &lt;li&gt;乘法公式：事件A与B同时发生的概率&lt;/li&gt;
&lt;/ul&gt;

\[P(AB)=P(A)P(B|A)\]

&lt;ul&gt;
  &lt;li&gt;全概率公式&lt;/li&gt;
  &lt;li&gt;贝叶斯公式&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>常用的JS组件</title>
   <link href="https://comeround.cn/article/js-component.html"/>
   <updated>2022-08-23T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/js-component</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;本文档所需的js文件均可到cdnjs库中查找，以下是cdnjs的镜像库&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.bootcdn.cn/&quot;&gt;bootcdn&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.staticfile.org/&quot;&gt;七牛云镜像&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/cdnjs/cdnjs/tree/master/ajax/libs&quot;&gt;github.com&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;一jquery&quot;&gt;一、JQuery&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;强大的JQ&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 点击事件&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;button[name=submit]&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ajax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;url&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;CONTEXT_PATH&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;/cusviews/pipe/showPipeList&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{},&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;success&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;debugger&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;jQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parseJSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;renderNation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;二bootstrap&quot;&gt;二、Bootstrap&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;前端组件&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2022/js-bootstrap.png&quot; alt=&quot;基本&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;三layui&quot;&gt;三、LayUI&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;LayUI的常用组件有&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;layer弹窗&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;laypage分页&lt;/code&gt;等&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href=&quot;https://layui.gitee.io/v2/docs/&quot;&gt;layui文档&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;四echarts&quot;&gt;四、Echarts&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;图表可视化&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2022/js-echarts.png&quot; alt=&quot;Echarts&quot; /&gt;&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;renderNation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;option&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{...};&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;myChart&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setOption&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;option&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;五iconfont&quot;&gt;五、iconfont&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2022/js-icon-fonts.png&quot; alt=&quot;图标&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;六wangeditor&quot;&gt;六、wangEditor&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;富文本编辑器&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2022/js-text.png&quot; alt=&quot;富文本编辑器&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;七viewerjs&quot;&gt;七、viewerjs&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;图片展示工具&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2022/js-viewerjs.png&quot; alt=&quot;展示图片&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;八docsifyjs&quot;&gt;八、docsify.js&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;自己制作markdown网页文档查看工具&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;九sweetalert2&quot;&gt;九、sweetalert2&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;弹窗组件&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;官方文档地址：https://sweetalert2.github.io/&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2022/js-sweetalert2.png&quot; alt=&quot;弹窗组件&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;十marked&quot;&gt;十、marked&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;一个能把前端markdown渲染成html的工具&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;十一exceljs&quot;&gt;十一、exceljs&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;前端生成导出excel、cvs文件&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;十二mockjs&quot;&gt;十二、mockjs&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;使用Mock.js生成数据代码&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;modata&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Mock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;mock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;tableData|2000&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[{&lt;/span&gt;
        &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@cname&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@date&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;address&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@city(true)&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;生成的数据如下&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;tableData&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;江磊&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;date&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;2014-01-17&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;address&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;湖北省 孝感市&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;郑涛&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;date&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1986-02-24&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;address&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;云南省 普洱市&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;十三crypto-js&quot;&gt;十三、crypto-js&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;基于JavaScript的数据加密解密&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;aes&quot;&gt;AES&lt;/h4&gt;

&lt;p&gt;AES加密方法主要有ECB和CBC两种方式， CBC需要秘钥key和偏移量iv，ECB只需要秘钥key&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getAesStringByCBC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;iv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//加密&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;CryptoJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;enc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Utf8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;iv&lt;/span&gt;   &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;CryptoJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;enc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Utf8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;iv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;encrypted&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CryptoJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;AES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;encrypt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;iv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;iv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CryptoJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CBC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;na&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CryptoJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Pkcs7&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;encrypted&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;//返回的是base64格式的密文&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;CryptoJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;enc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Utf8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;1234567812345678&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;plaintText&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;github.com&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;encryptedData&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;CryptoJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;AES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;encrypt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;plaintText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;CryptoJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ECB&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;  
    &lt;span class=&quot;na&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;CryptoJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Pkcs7&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;md5加密&quot;&gt;MD5加密&lt;/h4&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;CryptoJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;MD5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;toUpperCase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;sha256加密&quot;&gt;SHA256加密&lt;/h4&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;CryptoJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;SHA256&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;toUpperCase&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;base64转换&quot;&gt;base64转换&lt;/h4&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;CryptoJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;enc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Base64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CryptoJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;enc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Utf8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;inputstring&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//编码&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;CryptoJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;enc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Utf8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CryptoJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;enc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Base64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;MTIz&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;      &lt;span class=&quot;c1&quot;&gt;//解码&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;十四dayjs日期工具&quot;&gt;十四、dayjs日期工具&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;引入脚本&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;https://cdn.bootcdn.net/ajax/libs/dayjs/1.11.7/dayjs.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;https://cdn.bootcdn.net/ajax/libs/dayjs/1.11.7/plugin/duration.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;普通时间计算&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;dayjs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;YYYYMMDDHHmmss&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//生成20220924193656的格式&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;dayjs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;YYYY-MM-DD HH:mm:ss&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//生成2022-09-24 19:36:56的格式&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;dayjs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;unix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;YYYY-MM-DD&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//秒级时间戳转成日期格式&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;dayjs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;unix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;YYYY-MM-DD HH:mm:ss&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//秒级时间戳转成日期时间格式&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;dayjs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;datetime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;unix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//日期格式转为秒级时间戳&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;制作倒计时&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// 倒计时&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;dayjs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;extend&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;dayjs_plugin_duration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;daojishi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;endTime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;diffTime&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;dayjs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;duration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;endTime&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;dayjs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;year&lt;/span&gt;     &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;diffTime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;years&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;//年&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;month&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;diffTime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;months&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//月&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;day&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;diffTime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;days&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;//天&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;hours&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;diffTime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;hours&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;//小时&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;minutes&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;diffTime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;minutes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//分&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;seconds&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;diffTime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;seconds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//秒&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;year&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;年&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;month&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;月&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;day&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;天&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hours&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;小时&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;minutes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;分&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;seconds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;秒`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;setInterval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;daoji&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;innerHTML&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;daojishi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dayjs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;2025-02-02&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;unix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// console.log(daojishi(dayjs(&quot;2025-02-02&quot;).unix()));&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;https://dayjs.fenxianglu.cn/&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;十五复制到粘贴板clipboardjs&quot;&gt;十五、复制到粘贴板clipboardjs&lt;/h2&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/clipboard.js/2.0.11/clipboard.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;foo&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;copy-me&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;button&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;btn&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-clipboard-target=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;#foo&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    【1】点我复制#foo的内容
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;button&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;btn&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;data-clipboard-text=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;copy-me&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    【2】点我复制data-clipboard-text属性的内容
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;clipboardobj&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;【3】我要被复制了&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ClipboardJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.btn&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ClipboardJS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;.clipboardobj&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,{&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;trigger&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;trigger&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;innerText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//复制本身dom对象里面的文本&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;data-clipboard-target&lt;/code&gt;是复制一个dom对象的内容，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;data-clipboard-text&lt;/code&gt;直接复制文本&lt;/p&gt;

&lt;h2 id=&quot;十六获取url参数&quot;&gt;十六、获取URL参数&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;（1）qs.js&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://cdn.bootcdn.net/ajax/libs/qs/6.11.0/qs.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Qs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}));&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//a=b&amp;amp;b=c&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Qs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;y=u&amp;amp;t=io&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//{&quot;y&quot;:&quot;u&quot;,&quot;t&quot;:&quot;io&quot;}&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 访问地址为/list/index.html?page=1&amp;amp;name=bob&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Qs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]));&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//{&quot;page&quot;:1,&quot;name&quot;:&quot;bob&quot;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;（2）url.js&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;https://cdn.bootcdn.net/ajax/libs/urljs/2.7.0/url.min.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;page&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;queryString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//获取index?page=3得到3&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;obj&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parseQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//获取index?page=3&amp;amp;name=bob得到{&quot;page&quot;:3,&quot;name&quot;:&quot;bob&quot;}&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;bob&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//得到page=3&amp;amp;name=bob&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;https://www.xuexi.com:8089/path?name=value#hashx&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;//https://www.xuexi.com:8089/path?name=value#hashx&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;origin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;//https://www.xuexi.com:8089&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;protocol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//https:&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;//www.xuexi.com:8089&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hostname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//www.xuexi.com&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;//8089&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pathname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// /path&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;search&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;//?name=value&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hash&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;     &lt;span class=&quot;c1&quot;&gt;//#hashx&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;十七强大的数据处理工具lodashjs&quot;&gt;十七、强大的数据处理工具lodash.js&lt;/h2&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lodash.js&lt;/code&gt;提供强大的数据统计功能&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;（1）数据排序函数（相当于PHP的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;array_multisort&lt;/code&gt;函数）&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;fred0&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;48&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;province&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;guizhou&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;barney1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;34&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;province&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;chongqing&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;fred2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;40&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;province&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;guizhou&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;orderBy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;asc&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;desc&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// [&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//     {&quot;user&quot;:&quot;barney1&quot;,&quot;age&quot;:34,&quot;province&quot;:&quot;chongqing&quot;},&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//     {&quot;user&quot;:&quot;fred2&quot;,&quot;age&quot;:40,&quot;province&quot;:&quot;guizhou&quot;},&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//     {&quot;user&quot;:&quot;fred0&quot;,&quot;age&quot;:48,&quot;province&quot;:&quot;guizhou&quot;}&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// ]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;（2）索引分类函数（相当于PHP的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;array_column&lt;/code&gt;函数）&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;userkey&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;keyBy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// {&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//     &quot;barney1&quot;:{&quot;user&quot;:&quot;barney1&quot;,&quot;age&quot;:34,&quot;province&quot;:&quot;chongqing&quot;},&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//     &quot;fred2&quot;:{&quot;user&quot;:&quot;fred2&quot;,&quot;age&quot;:40,&quot;province&quot;:&quot;guizhou&quot;},&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//     &quot;fred0&quot;:{&quot;user&quot;:&quot;fred0&quot;,&quot;age&quot;:48,&quot;province&quot;:&quot;guizhou&quot;}&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// }&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;userkey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;fred2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//查找用户的年龄，省去了遍历数组查找&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;（3）分组函数（相当于PHP的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;array_group_by&lt;/code&gt;函数）&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;usergroup&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;groupBy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;province&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// {&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//     &quot;chongqing&quot;:[&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//         {&quot;user&quot;:&quot;barney1&quot;,&quot;age&quot;:34,&quot;province&quot;:&quot;chongqing&quot;}&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//     ],&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//     &quot;guizhou&quot;:[&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//         {&quot;user&quot;:&quot;fred2&quot;,&quot;age&quot;:40,&quot;province&quot;:&quot;guizhou&quot;},&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//         {&quot;user&quot;:&quot;fred0&quot;,&quot;age&quot;:48,&quot;province&quot;:&quot;guizhou&quot;}&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//     ]&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;还有一些其他函数：countBy、forEach、sumBy、chunk等&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.lodashjs.com/&quot;&gt;lodash.js官网&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;十八jquery弹窗插件jquery-confirm&quot;&gt;十八、jQuery弹窗插件jquery-confirm&lt;/h2&gt;

&lt;p&gt;该插件最后更新于2019年，v3.3.4&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;更新成功&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;学生信息已更新！&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;green&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;// blue/green/red/orange/purple&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;icon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;fa fa-check-circle&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;buttons&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;ok&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;知道了&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;十九程序员的pptrevealjs&quot;&gt;十九、程序员的PPT（reveal.js）&lt;/h2&gt;

&lt;p&gt;Reveal.js 是基于 HTML 的开源框架，用于创建动态网页演示，支持动画、代码高亮及多设备适配。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://revealjs.com/&quot;&gt;revealjs.com&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;二十前端实现读取excel文件&quot;&gt;二十、前端实现读取Excel文件&lt;/h2&gt;

&lt;p&gt;地址： https://cdn.staticfile.net/xlsx/0.18.5/xlsx.full.min.js&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Go语言之对象存储文件对比更新</title>
   <link href="https://comeround.cn/article/go-oss-compare-upload.html"/>
   <updated>2021-10-20T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/go-oss-compare-upload</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;前言&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;对于对象存储自动化管理，&lt;a href=&quot;/article/upyun-blog-client.html&quot;&gt;文件更新工具&lt;/a&gt; 已经描述了在windows上自动对比更新，即检测本地和对象存储的文件列表，选择被改动或者增加的文件进行上传，但未能达到自动化管理（定时检测）；以及阿里云效能够实现的把仓库文件推送到OSS的功能也存在问题（未对文件进行对比，上传多余文件），因此制作该程序可实现文件同步功能。&lt;/p&gt;

&lt;h2 id=&quot;1获取阿里云oss文件列表&quot;&gt;（1）获取阿里云OSS文件列表&lt;/h2&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ossFileList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;// 创建OSSClient实例。&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;oss&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;New&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://oss-cn-hongkong.aliyuncs.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;LTA*****toz&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;MIv*****JOT&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;HandleError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;c&quot;&gt;// 获取存储空间。&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;bucketName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;codepages&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bucketName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;HandleError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;c&quot;&gt;// 分页列举所有文件。每页列举100个。&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;continueToken&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;xcodes&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;make&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([]&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ObjectFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ossfile&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;ossfile&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;make&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;lsRes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bucket&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ListObjectsV2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;oss&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MaxKeys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;300&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;oss&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ContinuationToken&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;continueToken&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;HandleError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;xcode0&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;make&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([]&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ObjectFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lsRes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Objects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;c&quot;&gt;// 打印列举结果。默认情况下，一次返回100条记录。&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;object&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lsRes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Objects&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;// fmt.Println(object.Key, object.Type, object.Size, strings.ToLower(object.ETag), object.LastModified, object.StorageClass)&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;ossfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ToLower&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Trim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ETag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;xcodes&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;xcodes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;xcode0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lsRes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IsTruncated&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;continueToken&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lsRes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NextContinuationToken&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ossfile&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;2获取本地文件列表&quot;&gt;（2）获取本地文件列表&lt;/h2&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;localFileList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;originpath&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;localfile&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;localfile&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;make&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;filepath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Walk&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;originpath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FileInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IsDir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;c&quot;&gt;//fmt.Println(&quot;dir:&quot;, path)&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;// 忽略.git的目录文件&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HasPrefix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;originpath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.git&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inerr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;inerr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;md5h&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;md5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;New&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Copy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;md5h&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;md5string&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sprintf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%x&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;md5h&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;localfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TrimPrefix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;originpath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;md5string&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;localfile&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;3更新文件至阿里云oss&quot;&gt;（3）更新文件至阿里云OSS&lt;/h2&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ossUploadFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;localfile&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;// 创建OSSClient实例。&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;oss&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;New&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://oss-cn-hongkong.aliyuncs.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;LTA*****toz&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;MIv*****JOT&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;HandleError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;c&quot;&gt;// 获取存储空间。&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;bucketName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;codepages&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bucketName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;HandleError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;// 自定义HTTP头部消息&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;oss&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Option&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;oss&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CacheControl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;max-age=864000&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;// 上传本地文件。&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bucket&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;PutObjectFromFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;localfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Error:&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;[更新成功]&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;4主函数调用&quot;&gt;（4）主函数调用&lt;/h2&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;originpath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/home/wwwroot/linzening/&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;lofile&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;localFileList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;originpath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;osfile&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ossFileList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

    &lt;span class=&quot;c&quot;&gt;// 遍历本地&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lfile&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lofile&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c&quot;&gt;// OSS不存在某个文件&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ok&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;osfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ok&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;// 上传文件&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;[上传文件]&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;ossUploadFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;originpath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lofile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;osfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;// MD5不一致，更新文件&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;[更新文件]&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lofile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;osfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;ossUploadFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;originpath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lfile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;// 文件一致，不处理&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;// fmt.Println(&quot;[文件正常]&quot;, lfile)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;5程序实现&quot;&gt;（5）程序实现&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2021/go-oss-compare-upload.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;6日志记录&quot;&gt;（6）日志记录&lt;/h2&gt;

&lt;p&gt;由于使用定时器执行程序，要把日志输出到文件中，方便后续查询日志。&lt;/p&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;logFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;OpenFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;./oss-update.log&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;O_CREATE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;O_WRONLY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;O_APPEND&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0644&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;open log file failed, err:&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SetOutput&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;logFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;开始执行【&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ossBucket&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;】&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;7定时器执行&quot;&gt;（7）定时器执行&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;执行git代码同步本机后再执行本机同步到OSS&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;23 3 * * * cd /home/wwwroot/linzening/ &amp;amp;&amp;amp; git pull &amp;amp;&amp;amp; cd /home/wwwroot/staticfile/ &amp;amp;&amp;amp; git pull &amp;amp;&amp;amp; cd /data/cron/ &amp;amp;&amp;amp; /data/cron/codepages &amp;amp;&amp;amp; /data/cron/template-static-file
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;打开文件&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/data/cron/oss-update.log&lt;/code&gt;即可查询之前的执行日志。&lt;/p&gt;

&lt;h6 id=&quot;源代码&quot;&gt;源代码&lt;/h6&gt;

&lt;p&gt;https://github.com/linzening/code/blob/main/go/oss-update.go&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Go语言学习笔记</title>
   <link href="https://comeround.cn/article/go-lang-study.html"/>
   <updated>2021-08-26T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/go-lang-study</id>
   <content type="html">&lt;h2 id=&quot;1go备份mysql数据库至阿里云oss&quot;&gt;（1）Go备份MySQL数据库至阿里云OSS&lt;/h2&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;package&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
	&lt;span class=&quot;s&quot;&gt;&quot;fmt&quot;&lt;/span&gt;
	&lt;span class=&quot;s&quot;&gt;&quot;os&quot;&lt;/span&gt;
	&lt;span class=&quot;s&quot;&gt;&quot;os/exec&quot;&lt;/span&gt;
	&lt;span class=&quot;s&quot;&gt;&quot;time&quot;&lt;/span&gt;
	&lt;span class=&quot;s&quot;&gt;&quot;github.com/aliyun/aliyun-oss-go-sdk/oss&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;ossBucket&lt;/span&gt;          &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;da**xn&quot;&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;ossPoint&lt;/span&gt;           &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;http://oss-cn-chengdu.aliyuncs.com&quot;&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;ossAccessKeyId&lt;/span&gt;     &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;LT*********oz&quot;&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;ossAccessKeySecret&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;MI*********OT&quot;&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;originPath&lt;/span&gt;         &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/data/database/&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;originPath&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;linzening-db-&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;20060102150405&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;.sql.gz&quot;&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;cmd&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;exec&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/bin/sh&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;-c&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/usr/bin/mysqldump --host 127.0.0.1 --port 3306 -uroot -pword dbname | gzip &amp;gt; &quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;err1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cmd&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Run&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;error&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;databasefile:&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

	&lt;span class=&quot;c&quot;&gt;// 创建OSSClient实例。&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;oss&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;New&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ossPoint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ossAccessKeyId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ossAccessKeySecret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Error:&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;c&quot;&gt;// 获取存储空间。&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ossBucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Error:&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;c&quot;&gt;// 上传本地文件。按月份文件夹保存到OSS&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;osspath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;database-&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;2006&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;01&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/&quot;&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bucket&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;PutObjectFromFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;osspath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Error:&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Upload Success.&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h6 id=&quot;源代码&quot;&gt;源代码&lt;/h6&gt;

&lt;p&gt;https://github.com/linzening/code/blob/main/go/oss-backup.go&lt;/p&gt;

&lt;h2 id=&quot;2go处理nginx日志&quot;&gt;（2）Go处理Nginx日志&lt;/h2&gt;

&lt;h5 id=&quot;打印日志状态码统计&quot;&gt;打印日志状态码统计&lt;/h5&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;package&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;fmt&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;os&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;io/ioutil&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;strings&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;strconv&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;i6.log&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;日志路径：&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    
    &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;文件不存在&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ioutil&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ReadAll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;日志读取失败&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;strs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;countryCapitalMap&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;countryCapitalMap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;make&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;row&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;8&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strconv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Atoi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;100&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;600&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;countryCapitalMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;country&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;countryCapitalMap&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;country&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;状态码&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;countryCapitalMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;country&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;运行效果&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@ecs go]# go run log.go /home/wwwlogs/access.log
日志路径： /home/wwwlogs/access.log
200 状态码 1532
404 状态码 1057
150 状态码 113
403 状态码 127
146 状态码 6
400 状态码 331
405 状态码 103
304 状态码 350
302 状态码 1
301 状态码 2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;把日志统计输出到接口中&quot;&gt;把日志统计输出到接口中&lt;/h5&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;package&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;fmt&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;os&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;io/ioutil&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;strings&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;strconv&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;net/http&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;getinfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;i6.log&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;日志路径：&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;文件不存在&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ioutil&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ReadAll&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;日志读取失败&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;strs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;countryCapitalMap&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;countryCapitalMap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;make&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;countryCapitalUrl&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;countryCapitalUrl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;make&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;row&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;8&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strconv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Atoi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;100&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;600&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;countryCapitalMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;200&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;304&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;206&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;302&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;countryCapitalUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;,&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strconv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Itoa&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;,&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;strlog&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;[{&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;country&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;countryCapitalMap&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c&quot;&gt;// fmt.Println(country, &quot;状态码&quot;, countryCapitalMap[country])&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;strlog&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strconv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Itoa&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;country&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strconv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Itoa&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;countryCapitalMap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;country&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;,&quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;// 去掉最后一个字符&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;strlog&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strlog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strlog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;strlog&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;},{&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;country&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;countryCapitalUrl&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c&quot;&gt;// fmt.Println(countryCapitalUrl[country],country)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;country&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;country&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;country&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;country&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;00&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;strlog&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;country&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strconv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Itoa&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;countryCapitalUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;country&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;,&quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;strlog&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strlog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strlog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strlog&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;}]&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;helloHandler&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;struct&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;h&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;helloHandler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ServeHTTP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;w&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ResponseWriter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;getinfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Content-Type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;application/json; charset=utf-8&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Access-Control-Allow-Origin&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;web&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;web&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;服务器已启动：8000&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Handle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;helloHandler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{})&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ListenAndServe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;:8000&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;配置错误&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;生成二进制程序&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;go build flog.go&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;执行命令&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nohup ./flog /home/wwwlogs/ayouleyangs.log &amp;amp;&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;3go协程程序&quot;&gt;（3）Go协程程序&lt;/h2&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;package&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;fmt&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;time&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;//生产者&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Producer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;queue&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;chan&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;queue&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;//写入&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;2006-01-02 15:04:05&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;create :&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Second&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;//消费者&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Consumer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;queue&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;chan&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;v&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;queue&lt;/span&gt;  &lt;span class=&quot;c&quot;&gt;// 读出&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;2006-01-02 15:04:05&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;receive:&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;queue&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;make&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;chan&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;88&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;go&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Producer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;queue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;go&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Consumer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;queue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;12&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Second&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;无限循环语句&quot;&gt;无限循环语句&lt;/h5&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;//消费者&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Consumer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;queue&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;chan&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;v&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;queue&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;2006-01-02 15:04:05&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;receive:&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;4使用go做一个http服务器&quot;&gt;（4）使用Go做一个HTTP服务器&lt;/h2&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2022年8月23日&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;package&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;flag&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;fmt&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;log&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;net/http&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;os&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;path&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;strconv&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dir&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;port&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;indexs&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;// 初始化参数&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;dir&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;本地地址：&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;flag&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IntVar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;port&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;服务器端口&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;flag&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;indexs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;index.html&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;index.htm&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HandleFunc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;StaticServer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ListenAndServe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;:&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strconv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Itoa&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Fatal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;ListenAndServe: &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;// 静态文件处理&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;StaticServer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;w&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ResponseWriter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;req&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dir&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Path&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;fi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Stat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IsNotExist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NotFound&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fi&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IsDir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&apos;/&apos;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Redirect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;301&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;indexs&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;fi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Stat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;continue&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ServeFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NotFound&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ServeFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;配置dir为本地目录，访问 http://127.0.0.1/ 即可&lt;/p&gt;

&lt;h2 id=&quot;5又拍云存储制作文件浏览器-20230616&quot;&gt;（5）又拍云存储制作文件浏览器-20230616&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;遍历又拍云的目录结构&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;UpyunFileList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;upyun&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FileInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;resultpush&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;make&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;upyun&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FileInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;objsChan&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;make&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;chan&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;upyun&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FileInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;go&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;up&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;upyun&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GetObjectsConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Path&lt;/span&gt;        &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;ObjectsChan&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objsChan&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}()&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;objsChan&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;resultpush&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;resultpush&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ContentType&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;folder&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;UpyunFileList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    
    &lt;span class=&quot;n&quot;&gt;MakePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;resultpush&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;//每个目录生成一个html文件&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;每一层目录生成一个html文件&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MakePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;upyun&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FileInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;vpath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Trim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;_&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;rpath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vpath&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;lpath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vpath&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vpath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;rpath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;default&quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;lpath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lpath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;_&quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;liststr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;...&quot;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;// html的头部部分&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vpath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c&quot;&gt;// 返回上一级目录(需要计算上一级目录的情况)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;dpath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Trim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;dpath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;_&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;dpath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;default&quot;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;liststr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;liststr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;a class=&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;octicon file-directory&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; href=&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dpath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.html&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;gt;..&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;dhtml&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;fhtml&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ContentType&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;folder&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;dhtml&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dhtml&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;a class=&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;octicon file-directory&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; href=&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lpath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.html&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;2006-01-02 15:04:05&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strconv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FormatInt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;fhtml&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fhtml&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;a class=&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;octicon file&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; href=&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;2006-01-02 15:04:05&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strconv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FormatInt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;liststr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;liststr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dhtml&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fhtml&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;liststr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;liststr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;/tbody&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;a/&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rpath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.html&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;defer&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;writer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bufio&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NewWriter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;writer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WriteString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;liststr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;writer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Flush&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;原始目录结构&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;direct
├── mysql
│   ├── Downloads
│   │   ├── MySQL-8.0
├── soft
│   ├── datebase
│   │   ├── phpmyadmin
│   ├── lib
│   │   ├── freetype
│   │   ├── lua
│   │   ├── openssl
│   ├── lnmp
│   ├── prober
│   ├── web
│   │   ├── libiconv
│   │   ├── libmcrypt
│   │   ├── mcrypt
│   │   ├── mhash
│   │   ├── nginx
│   │   ├── pcre
│   │   ├── php
│   │   │   ├── composer
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;生成的文件&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;default.html
mysql.html
mysql_Downloads.html
mysql_Downloads_MySQL-8.0.html
soft.html
soft_datebase.html
soft_datebase_phpmyadmin.html
soft_lib.html
soft_lib_freetype.html
soft_lib_lua.html
soft_lib_openssl.html
soft_lnmp.html
soft_prober.html
soft_web.html
soft_web_libiconv.html
soft_web_libmcrypt.html
soft_web_mcrypt.html
soft_web_mhash.html
soft_web_nginx.html
soft_web_pcre.html
soft_web_php.html
soft_web_php_composer.html
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;预览效果&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2023/upyun-browser.png&quot; alt=&quot;预览效果&quot; /&gt;&lt;/p&gt;

&lt;h6 id=&quot;源代码-1&quot;&gt;源代码：&lt;/h6&gt;

&lt;p&gt;https://github.com/linzening/code/blob/main/go/upyun-browser.go&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>MySQL入门</title>
   <link href="https://comeround.cn/article/mysql-in-door.html"/>
   <updated>2021-07-16T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/mysql-in-door</id>
   <content type="html">&lt;h2 id=&quot;一介绍&quot;&gt;一、介绍&lt;/h2&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MySQL&lt;/code&gt;是一款安全、跨平台、高效的，并与 PHP、Java 等主流编程语言紧密结合的数据库系统。该数据库系统是由瑞典的 MySQL AB 公司开发、发布并支持，由 MySQL 的初始开发人员 David Axmark 和 Michael Monty Widenius 于 1995 年建立的。&lt;/p&gt;

&lt;h2 id=&quot;二安装&quot;&gt;二、安装&lt;/h2&gt;

&lt;h3 id=&quot;windows系统下&quot;&gt;Windows系统下&lt;/h3&gt;

&lt;h4 id=&quot;集成方式安装&quot;&gt;集成方式安装&lt;/h4&gt;

&lt;blockquote&gt;
  &lt;p&gt;如果仅仅是为了使用MySQL，建议直接使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;phpenv&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;phpStudy&lt;/code&gt;进行一键安装，即可使用。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4 id=&quot;原始安装&quot;&gt;原始安装&lt;/h4&gt;

&lt;p&gt;&lt;a href=&quot;https://dev.mysql.com/downloads/mysql/&quot;&gt;下载&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;linux系统下&quot;&gt;Linux系统下&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;/article/mysql-8020-bash.html&quot;&gt;安装MySQL-8.0.20数据库&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;三配置&quot;&gt;三、配置&lt;/h2&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nn&quot;&gt;[mysqld]&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 设置3306端口
&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;3306&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 设置mysql的安装目录
&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;basedir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;F:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;phpEnv&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;mysql-8.0.25   # 切记此处一定要用双斜杠&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;
# 设置mysql数据库的数据的存放目录
datadir=F:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;phpEnv&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;mysql-8.0.25&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Data   # 此处同上
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
max_connect_errors=10
# 服务端使用的字符集默认为UTF8
character-set-server=utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
default_authentication_plugin=mysql_native_password
#严格模式下使用这个
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
#非严格模式下
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#较大数据导入
max_allowed_packet = 1024M

[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;四理论&quot;&gt;四、理论&lt;/h2&gt;

&lt;h3 id=&quot;存储引擎&quot;&gt;存储引擎&lt;/h3&gt;

&lt;p&gt;在MySQL中，主要的存储引擎有两种：MyIsam和InnoDB。&lt;/p&gt;

&lt;p&gt;MyIsam是高速引擎，拥有较高的插入、查询速度。但不支持事务、行为等；&lt;/p&gt;

&lt;p&gt;InnoDB是5.5版本后MySQL默认的数据库，支持事务和行级锁定，事务处理、回滚、崩溃修复能力和多版本并发控制，比MyIsam处理速度稍慢，支持外键。&lt;/p&gt;

&lt;p&gt;InnoDB：支持事务处理，支持外键，支持崩溃修复能力和并发控制。如果需要对事务的完整性要求比较高（比如银行），要求实现并发控制（比如售票），那一般都会选择InnoDB。如果需要频繁的更新、删除操作的数据库，也可以选择InnoDB，因为它支持事务的提交和回滚。&lt;/p&gt;

&lt;p&gt;MyIsam：插入数据快，空间和内存使用比较低。如果表主要是用于插入新纪录和读出记录，那么选择MyIsam能实现处理高效率。&lt;/p&gt;

&lt;h3 id=&quot;数据格式&quot;&gt;数据格式&lt;/h3&gt;

&lt;h5 id=&quot;innodb数据文件&quot;&gt;InnoDB数据文件&lt;/h5&gt;

&lt;ol&gt;
  &lt;li&gt;.frm文件：主要存放与表相关的数据信息，主要包括表结构的定义信息。&lt;/li&gt;
  &lt;li&gt;.ibd文件：使用表独享表空间存储表数据和索引信息，一张表对应一个ibd文件。&lt;/li&gt;
  &lt;li&gt;.bdata文件：使用共享表空间存储表数据和索引信息，所有表共同使用一个或多个ibdata文件&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;myisam数据文件&quot;&gt;MyIsam数据文件&lt;/h5&gt;

&lt;ol&gt;
  &lt;li&gt;.frm文件：主要存放与表相关的数据信息，主要包括表结构的定义信息。&lt;/li&gt;
  &lt;li&gt;.myd文件：主要用来存储表数据信息。&lt;/li&gt;
  &lt;li&gt;.myi文件：主要用来存储表数据文件中任何索引的数据树。&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;数据类型&quot;&gt;数据类型&lt;/h5&gt;

&lt;p&gt;整型：tinyint(一个字节/int8)、smallint(2个字节/int16)、mediumint(3个字节/int24)、int(4个字节/int32)、bigint(8个字节/int64)&lt;/p&gt;

&lt;h3 id=&quot;索引原则&quot;&gt;索引原则&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;选择唯一性索引&lt;/li&gt;
  &lt;li&gt;为经常需要排序、分组和联合操作的字段建立索引&lt;/li&gt;
  &lt;li&gt;为常作为查询条件的字段建立索引&lt;/li&gt;
  &lt;li&gt;限制索引的数目&lt;/li&gt;
  &lt;li&gt;尽量使用数据量少的索引&lt;/li&gt;
  &lt;li&gt;尽量使用前缀来索引&lt;/li&gt;
  &lt;li&gt;删除不再使用或者很少使用的索引&lt;/li&gt;
  &lt;li&gt;最左前缀匹配原则，非常重要的原则。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.=&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;in&lt;/code&gt;可以乱序。&lt;/li&gt;
  &lt;li&gt;尽量选择区分度高的列作为索引。&lt;/li&gt;
  &lt;li&gt;索引列不能参与计算，保持列“干净”。&lt;/li&gt;
  &lt;li&gt;尽量的扩展索引，不要新建索引。&lt;/li&gt;
  &lt;li&gt;当单个索引字段查询数据很多，区分度都不是很大时，则需要考虑建立联合索引来提高查询效率&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
  &lt;li&gt;适合做索引：主键、外键、手机号、学号、状态&lt;/li&gt;
  &lt;li&gt;不适合做索引：性别、姓名、时间、价格、数量&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;五语法&quot;&gt;五、语法&lt;/h2&gt;

&lt;h3 id=&quot;1常用语句&quot;&gt;（1）常用语句&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;查询&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SELECT * FROM `record` WHERE `id` = 616;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;新增&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;INSERT INTO `record`(`id`,`tid`,`score`,`remark`) VALUES(1,2,98,&apos;优秀&apos;);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;修改&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;UPDATE `record` SET `score` = 92 , `remark` = &quot;优秀&quot; WHERE `id` = 616;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;删除&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;DELETE FROM `record` WHERE `id` = 616;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;排序&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SELECT * FROM `record` WHERE `tid` = 1 ORDER BY `score` DESC,`id` ASC;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;查询固定数量(偏移量，查询量)&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SELECT * FROM `record` WHERE `tid` = 1 LIMIT 10,10;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;左联表&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SELECT `a`.*,`b`.`name` FROM `record` AS a LEFT JOIN `b` ON `a`.`bid` = `b`.`id` WHERE a.`id` = 616;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;求和&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SELECT sum(`score`) AS `total` FROM `record` WHERE `tid` = 616;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;分组&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SELECT `tid`,sum(`score`) AS `total` FROM `record` GROUP BY `tid`;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;2常用函数&quot;&gt;（2）常用函数&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;函数名称&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;示例&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;结果&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;描述&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;concat&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;concat(s1,s2…sn)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;s1s2s3&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;字符串拼接&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;insert&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;insert(str,x,y,insert)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;123&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;字符串替换&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;lower/upper&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;upper(&apos;a&apos;)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;A&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;大小写转换&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;left/right&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;———&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;——–&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;——–&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;lpad/rpad&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;———&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;——–&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;——–&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;trim/ltrim/rtrim&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;———&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;——–&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;——–&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;replace&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;———&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;——–&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;——–&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;strcmp&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;———&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;——–&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;——–&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;substring&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;substring(&apos;1234567890&apos;,2,4)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2345&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;字符串截取&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;abs&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;abs(-80)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;80&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;绝对值&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;ceil&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;ceil(8.36)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;9&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;天花板向上取整&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;floor&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;floor(8.36)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;8&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;向下取整&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;mod&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;mod(22,4)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;取余&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;rand&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;rand()&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;0.5459487750622898&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;返回0-1随机小数&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;round&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;round(2.62)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;3&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;四舍五入&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;truncate&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;truncate(1.245,2)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;1.24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;保留两位小数&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;curdate&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;curdate()&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2021-09-24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;获取当前日期&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;curtime&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;curtime()&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;11:54:59&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;获取当前时间&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;now&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;now()&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2021-09-24 11:51:18&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;获取当前时间&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;DATE_FORMAT&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;DATE_FORMAT(‘2021-12-11 12:23:34’,’%Y-%m-%d’)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2021-09-24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;获取日期&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;unix_timestamp&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;unix_timestamp()&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;1632455518&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;获取当前时间戳&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;from_unixtime&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;from_unixtime(1632455518)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2021-09-24 11:51:58&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;时间戳转换成时间格式&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;week&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;week(&quot;2021-09-24 11:51:58&quot;)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;38&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;获取在当年的第几周&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;year&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;year(&quot;2021-09-24 11:51:58&quot;)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2021&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;获取年份&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;hour&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;hour(&quot;2021-09-24 11:51:58&quot;)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;11&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;获取小时&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;database&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;database()&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;mysql&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;查询当前数据库&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;version&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;version()&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;8.0.20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;查询数据库版本&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;user&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;user()&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;root@localhost&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;查询当前用户&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;password&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;password(&quot;123&quot;)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;———-&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;密码加密&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;md5&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;md5(&apos;1234&apos;)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;81d…055&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;MD5加密&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;inet_aton/inet_ntoa&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;inet_aton(&apos;192.168.1.1&apos;)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;3232235777&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;IPv4转数字&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;inet6_aton/inet6_ntoa&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;0&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;0&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;IPv6转&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;3库和表操作&quot;&gt;（3）库和表操作&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;删除库&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;drop database table_name;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;删除表&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;drop table table_name;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;清空表，重置id&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;truncate table table_name;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;4函数示例&quot;&gt;（4）函数示例&lt;/h3&gt;

&lt;h5 id=&quot;字符串拼接-concat&quot;&gt;字符串拼接-CONCAT&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;在某字段上增加内容&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;UPDATE `record` SET `remark` = CONCAT(`remark`,&quot;,增加其他备注&quot;) WHERE `id` = 616;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;读取某字段并用逗号拼接 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a,b,c,d&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SELECT GROUP_CONCAT(`telephone`) FROM `b_admin`;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;find_in_set&quot;&gt;FIND_IN_SET&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SELECT * FROM wii_project WHERE name FIND_IN_SET(`participant`,&apos;{$myid}&apos;)
SELECT `realname`,`studentid` FROM `b_userinfo` WHERE `id` IN (101,102,103);
SELECT * FROM b_admin WHERE account IN (&apos;user1&apos;,&apos;user2&apos;);
用于查找以逗号分隔的多个数字，例如names：&quot;张三,李四,王五&quot;
SELECT FIND_IN_SET(&apos;b&apos;,&apos;a,b,c,d&apos;);返回2
SELECT FIND_IN_SET(&apos;b&apos;,`sets`);//左边为单一的，右边为多个
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;记住：能用IN就用IN，不能用IN再用FIND_IN_SET。&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;json查询&quot;&gt;JSON查询&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;查询json内部字段&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SELECT collect-&amp;gt;&amp;gt;&quot;$.ip&quot; AS ip FROM `b_volunteer`;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;json中增加某个字段&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;UPDATE t_json SET info = json_set(info,&apos;$.ip&apos;,&apos;192.168.1.1&apos;);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;六维护&quot;&gt;六、维护&lt;/h2&gt;

&lt;h3 id=&quot;linux下mysql数据库备份&quot;&gt;Linux下MySQL数据库备份&lt;/h3&gt;

&lt;h5 id=&quot;普通备份&quot;&gt;普通备份&lt;/h5&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysqldump -u root -p[password] [database] &amp;gt; /tmp/mydatabasename.sql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h5 id=&quot;压缩备份&quot;&gt;压缩备份&lt;/h5&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysqldump -h主机名 -u用户名 -p密码 数据库名字  | gzip &amp;gt;备份的数据库名字.sql.gz
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h5 id=&quot;全备份&quot;&gt;全备份&lt;/h5&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysqldump --all-databases -h主机名 -u用户名 -p密码 &amp;gt; 备份数据库名字.sql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h5 id=&quot;备份表&quot;&gt;备份表&lt;/h5&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysqldump -u root -p[password] [database] [table1] [table2] &amp;gt; /tmp/mydatabasename.sql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h5 id=&quot;不备份某个表&quot;&gt;不备份某个表&lt;/h5&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysqldump -u root -p[password] [database] --ignore-table=[database].[table_not] &amp;gt; /tmp/mydatabasename.sql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h5 id=&quot;带条件备份&quot;&gt;带条件备份&lt;/h5&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysqldump -u root -p[password] [database] [table] --where=&quot;id&amp;lt;1000&quot; &amp;gt; /tmp/mydatabasename.sql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h5 id=&quot;linux定时器备份&quot;&gt;Linux定时器备份&lt;/h5&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;40 2 * * * /usr/bin/mysqldump -u root -p[password] [database] &amp;gt; /tmp/database/[database]-`date +%s`.sql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;style&gt;
.highlight {
    background-color: #f4f4f4;
    border:1px solid #d6d8da;
}
pre code{
    color: #515158;
}
&lt;/style&gt;

</content>
 </entry>
 
 <entry>
   <title>使用.NET制作一个HTTP静态文件服务器</title>
   <link href="https://comeround.cn/article/make-a-webserver-by-dotnet.html"/>
   <updated>2021-06-27T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/make-a-webserver-by-dotnet</id>
   <content type="html">&lt;h6 id=&quot;意义&quot;&gt;意义&lt;/h6&gt;

&lt;p&gt;可能觉得这是在做了一个轮子，回想当初学习http协议时，需要了解各种协议头的作用，但是那时候只是在学习，没有真正去测试http各种头部的含义。在此，重新做了一个静态文件服务器，以学习http知识及dotnet应用。&lt;/p&gt;

&lt;h2 id=&quot;一使用控制台制作服务&quot;&gt;一、使用控制台制作服务&lt;/h2&gt;

&lt;h3 id=&quot;1简单http服务&quot;&gt;（1）简单http服务&lt;/h3&gt;

&lt;h4 id=&quot;生成socket服务绑定ip和端口&quot;&gt;生成socket服务，绑定IP和端口&lt;/h4&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;Socket&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;socket&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Socket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AddressFamily&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;InterNetwork&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SocketType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ProtocolType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Tcp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Bind&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;IPEndPoint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IPAddress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Any&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;10080&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Listen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//接收客户端的 Socket请求&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;BeginAccept&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;OnAccept&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;每个http请求处理&quot;&gt;每个HTTP请求处理&lt;/h4&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;serverSocket&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AsyncState&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Socket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//获取到客户端的socket&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;clientSocket&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;serverSocket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;EndAccept&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//进行下一步监听&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;serverSocket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;BeginAccept&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;OnAccept&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;serverSocket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//响应头部部分&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;clientSocket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UTF8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetBytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;responseHeader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//响应body部分&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;clientSocket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UTF8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetBytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;response_text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;2处理request信息&quot;&gt;（2）处理request信息&lt;/h3&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;10000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//获取socket的内容&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;len&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;clientSocket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Receive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//request为请求头，将 bytes[] 转换 string&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UTF8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//从请求头中获取path部分“GET /index.html HTTP/1.1”&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;\r\n&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;TrimStart&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sc&quot;&gt;&apos;/&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;request的头部内容&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;GET /index.html HTTP/1.1
Host: 127.0.0.1:10080
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-Fetch-Site: none
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,ja;q=0.7
Cookie: _ga=GA1.1.1017728174.1598968861

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;3处理响应头部&quot;&gt;（3）处理响应头部&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HTTP/1.1 {0}
Date: {1}
Expires: {2}
Server: {3}
Content-Type: {4}
Cache-Control: max-age=86400
Connection: keep-alive
Content-Length: {5}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;http_status_code,
System.DateTime.Now.ToString(&quot;R&quot;),
DateTime.Now.AddDays(1).ToString(&quot;R&quot;),
&quot;WebServer&quot;,
content_type,
content_length
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;注意：响应头部最后有两个回车换行“\r\n\r\n”。&lt;/p&gt;

&lt;h5 id=&quot;处理状态码&quot;&gt;处理状态码&lt;/h5&gt;

&lt;p&gt;最常用状态码为200、404，在正确返回文件时，返回200状态码，当文件不存在时，需要返回404状态码。简单文件服务器一般不使用其他状态码&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;http_status_code&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;200 OK&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//设置默认状态码&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;http_status_code&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;404 Not Found&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//当文件不存在时响应404状态码&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;content-type的判断&quot;&gt;Content-Type的判断&lt;/h5&gt;

&lt;p&gt;参考Nginx程序的响应方式，将&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/nginx/conf/mime.types&lt;/code&gt;文件解析成Dictionary类型的数据，从请求文件中获取到文件的扩展名，对应到mime-type。&lt;/p&gt;

&lt;h5 id=&quot;content-length的计算&quot;&gt;Content-Length的计算&lt;/h5&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;//字节流计算&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;response_file&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ReadAllBytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;BitArray&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myBA&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;BitArray&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;response_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;content_length&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Convert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ToInt32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;myBA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Length&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//文本类型&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;response_text&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ReadAllText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UTF8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;content_length&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UTF8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetByteCount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;response_text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Content-Length可不返回，但是返回就必须和真实的文件大小一致。&lt;/p&gt;

&lt;h3 id=&quot;4响应字节流文件&quot;&gt;（4）响应字节流文件&lt;/h3&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;response_file&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ReadAllBytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;BitArray&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myBA&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;BitArray&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;response_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;content_length&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Convert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ToInt32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;myBA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Length&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;5响应文本文件&quot;&gt;（5）响应文本文件&lt;/h3&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;response_text&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ReadAllText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UTF8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;content_length&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UTF8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetByteCount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;response_text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;6特殊文件处理&quot;&gt;（6）特殊文件处理&lt;/h3&gt;

&lt;h5 id=&quot;默认首页&quot;&gt;默认首页&lt;/h5&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;index.html&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 以`/`为末尾的，默认获取该目录下的`index.html`文件&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Substring&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Length&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;index.html&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//默认页面&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;文件不存在时&quot;&gt;文件不存在时&lt;/h5&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;//获取文件内容&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// ... 获取文件，若获取失败，则抛出异常&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Exception&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;http_status_code&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;404 Not Found&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;response_text&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ReadAllText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;webpath&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;404.html&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UTF8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;content_type&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;text/html&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;content_length&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UTF8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetByteCount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;response_text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;去除问号访问&quot;&gt;去除问号访问&lt;/h5&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Contains&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;?&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;filePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;?&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;7效果预览&quot;&gt;（7）效果预览&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2021/dotnet-http-server-1.png&quot; alt=&quot;服务日志&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;h6 id=&quot;总结&quot;&gt;总结&lt;/h6&gt;

&lt;p&gt;做简易自主的本地静态文件服务器，效果还是不错的。之后做成桌面应用程序，双击软件即运行站点。&lt;/p&gt;

&lt;h5 id=&quot;todo优化&quot;&gt;TODO+优化&lt;/h5&gt;

&lt;ol&gt;
  &lt;li&gt;未处理子目录下的默认文件，例如&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/html/&lt;/code&gt;要访问到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/html/index.html&lt;/code&gt;【已完成】&lt;/li&gt;
  &lt;li&gt;服务端没有找到文件时，要返回404状态码和默认404页面。【已完成】&lt;/li&gt;
  &lt;li&gt;获取请求头的host，访问到不同的站点（虚拟主机）。&lt;/li&gt;
  &lt;li&gt;带参数时获取不到文件，例如&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.html?id=123&lt;/code&gt;需要把&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;?&lt;/code&gt;及后面的参数过滤，带&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#&lt;/code&gt;的URL无需处理。【已完成】&lt;/li&gt;
  &lt;li&gt;每个HTTP请求都占用一个连接，需要保持同一个TCP连接请求。&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;资源消耗&quot;&gt;资源消耗&lt;/h5&gt;

&lt;p&gt;Nginx占用内存1.5MB，该应用占用25MB，当然是不能和Nginx相比较的。&lt;/p&gt;

&lt;h5 id=&quot;http头部问题&quot;&gt;HTTP头部问题&lt;/h5&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Pragma: no-cache&lt;/code&gt;需要去掉，避免缓存失效。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Cache-Control: max-age=86400&lt;/code&gt;设置缓存1天。&lt;/li&gt;
  &lt;li&gt;请求头的操作，HTTP服务端指定的Host是以头部的Host为准，URL上的Host是无效的。&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;C:\Users\admin&amp;gt;curl http://127.0.0.1/ -H &quot;Host: fe80.cn&quot; -v
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
&amp;gt; GET / HTTP/1.1
&amp;gt; Host: fe80.cn
&amp;gt; User-Agent: curl/7.55.1
&amp;gt; Accept: */*
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;你的主机中的软件中止了一个已建立的连接的问题&quot;&gt;“你的主机中的软件中止了一个已建立的连接”的问题&lt;/h5&gt;

&lt;p&gt;出现原因：&lt;/p&gt;

&lt;p&gt;1、由于客户端在发送请求后，还没等服务器响应就断开了连接，有可能是因为网络原因，突然网断了，但是如果错误频繁出现的话，可能就是服务端的问题了。&lt;/p&gt;

&lt;p&gt;2、有可能是后台处理时间太长了。&lt;/p&gt;

&lt;p&gt;3、服务器的并发连接数超过了其承载量，服务器会将其中一些连接Down掉。&lt;/p&gt;

&lt;p&gt;4、客户关掉了浏览器，而服务器还在给客户端发送数据。&lt;/p&gt;

&lt;p&gt;5、出现404或者获取不到文件时出现该问题。&lt;/p&gt;

&lt;p&gt;6、访问过于频繁时404的文件报该问题。&lt;/p&gt;

&lt;p&gt;等其他原因，但这个问题还没有解决。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;使用Wireshark抓包&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;过滤参数 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http &amp;amp;&amp;amp; tcp.port == 10080&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2021/dotnet-http-server-2.png&quot; alt=&quot;抓包诊断&quot; /&gt;&lt;/p&gt;

&lt;p&gt;通过抓包发现，一个请求有两个响应。后面查到该请求的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;request&lt;/code&gt;为空，因此应该不做处理，否则返回200的空响应会终止该连接。&lt;/p&gt;

&lt;h5 id=&quot;学习文档&quot;&gt;学习文档&lt;/h5&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;https://blog.csdn.net/zjc405068789/article/details/104074762&quot;&gt;.net core 使用控制台开发简单的web服务器，接收http请求并响应请求&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;style&gt;
.highlight {
    background-color: #f4f4f4;
}
pre code{
    color: #515158;
}
&lt;/style&gt;

</content>
 </entry>
 
 <entry>
   <title>Linux命令指南</title>
   <link href="https://comeround.cn/article/linux-command.html"/>
   <updated>2021-05-31T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/linux-command</id>
   <content type="html">&lt;h3 id=&quot;系统&quot;&gt;系统&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# uname -a               # 查看内核/操作系统/CPU信息
# uname -r               # 查看内核
# head -n 1 /etc/issue   # 查看操作系统版本
# cat /proc/cpuinfo      # 查看CPU信息
# hostname               # 查看计算机名
# lspci -tv              # 列出所有PCI设备
# lsusb -tv              # 列出所有USB设备
# lsmod                  # 列出加载的内核模块
# env                    # 查看环境变量
# chmod 600 id_rsa       # 设置权限
# chattr +i .user.ini    # 加锁
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;资源&quot;&gt;资源&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# free -m                       # 查看内存使用量和交换区使用量
# df -h                         # 查看各分区使用情况
# du -sh &amp;lt;path&amp;gt;                 # 查看指定目录的大小
# grep MemTotal /proc/meminfo   # 查看内存总量
# grep MemFree /proc/meminfo    # 查看空闲内存量
# uptime                        # 查看系统运行时间、用户数、负载
# cat /proc/loadavg             # 查看系统负载 (解释详见:http://blog.haohtml.com/index.php/archives/6860)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;磁盘和分区&quot;&gt;磁盘和分区&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# mount | column -t      # 查看挂接的分区状态
# fdisk -l               # 查看所有分区
# mount device dir       # 挂载磁盘到目录
# swapon -s              # 查看所有交换分区
# hdparm -i /dev/hda     # 查看磁盘参数(仅适用于IDE设备)
# dmesg | grep IDE       # 查看启动时IDE设备检测状况
# du -sh *               # 查看文件夹占用空间
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;网络&quot;&gt;网络&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# ifconfig               # 查看所有网络接口的属性
# iptables -L            # 查看防火墙设置
# ifstat                 # 查看网卡流量使用
# route -n               # 查看路由表
# netstat -lntp          # 查看所有监听端口
# netstat -antp          # 查看所有已经建立的连接
# netstat -s             # 查看网络统计信息
# mtr                    # 路由/丢包检测
# traceroute             # 路由跟踪
# tcping                 # tcp端口检测
# ping                   # icmp检测
# dig                    # 域名解析
# nslookup               # 域名解析
# route                  # 查看路由表
# nmcli                  # 网络管理
# nmcli c reload         # 重启网卡
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;进程&quot;&gt;进程&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# ps -ef                 # 查看所有进程
# top                    # 实时显示进程状态
# htop                   # 实时显示进程状态（高级）
# atop                   # 实时显示进程状态（高级）
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;用户&quot;&gt;用户&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# w                         # 查看活动用户
# id &amp;lt;name&amp;gt;                 # 查看指定用户信息
# last                      # 查看用户登录日志
# cut -d: -f1 /etc/passwd   # 查看系统所有用户
# cut -d: -f1 /etc/group    # 查看系统所有组
# crontab -l                # 查看当前用户的计划任务
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;服务&quot;&gt;服务&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# chkconfig --list              # 列出所有系统服务
# chkconfig --list | grep on    # 列出所有启动的系统服务
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;程序&quot;&gt;程序&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# rpm -qa                       # 查看所有安装的软件包
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;请求&quot;&gt;请求&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# curl -x 127.0.0.1:80 http://www.haxx.com/                                  # 指定IP请求http
# curl --resolve &apos;www.abc.com:443:180.101.49.11&apos; https://www.abc.com/ -vvv   # 指定IP请求https
# curl http://www.haxx.com/[1-100].jpg                                       # 批量下载资源
# wget https://curl.haxx.se/download/curl-7.51.0.tar.gz                      # 下载某个文件
# wget -i filelist.txt                                                       # 批量下载文件内的链接
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;文件&quot;&gt;文件&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# cat                                              # 获取文本内容
# cat filename | awk &apos;{print $1}&apos;                  # 获取第一列
# sed -i &apos;s/a/b/g&apos; filename                        # 全局替换
# find . -name &quot;upgrade.sh&quot; -print                 # 在当前目录查找文件名
# scp a.gz root@39.106.210.153:/home               # 复制文件到远程机器
# scp root@[ip]:/root/1.log ./1.log                # 从远程机器下载到本地
# seq 5 | tr &quot;\n&quot; &quot;|&quot;                              # 输出序号“1|2|3|4|5|”
# cat access.log| tr &quot;.&quot; &quot;-&quot;                       # 输出文本时把A换成B
# grep -v &quot;abc&quot; filename                           # 输出没有abc的行
# cut -d &apos; &apos; -f 9 access.log                       # Nginx日志中只列出状态码，类似awk
# wc -l access.log                                 # 查看文件共有多少行
# tree                                             # 列出该目录下所有子文件
# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3  # 设置软链A到B
# md5sum filename                                  # 获取文件的md5值
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;压缩解压命令&quot;&gt;压缩解压命令&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# zip newzip.zip *                                 # 打包当前目录的所有文件为newzip.zip
# unzip filename.zip                               # 解压filename.zip到当前目录
# tar -czvf new.tar.gz *                           # 打包当前目录的所有文件为new.tar.gz
# tar -zxvf new.tar.gz                             # 解压new.tar.gz到当前目录
# bzip2 -z fileName                                # bz2压缩
# bunzip2 fileName                                 # bz2解压
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;工具&quot;&gt;工具&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# screen -S lnmp                                   # 创建名为lnmp的session
# screen -r lnmp                                   # 恢复进入名为lnmp的session
# screen -ls                                       # 查看session列表
# nohup python run.py &amp;amp;                            # 运行程序到守护进程
# setsid acommand                                  # 
# ssh root@ip &quot;uptime&quot;                             # 远程执行命令
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;文件位置&quot;&gt;文件位置&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/etc/hosts                                  # 域名指向
/etc/resolve.conf                           # DNS的地址
/etc/hostname                               # 主机名称
/etc/sysconfig/network-scripts/ifcfg-eth0   # IP配置文件
/etc/profile                                # 环境变量，重载生效`source ~/.bash_profile`
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;软件安装centos&quot;&gt;软件安装（CentOS）&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;yum install -y bind-utils                   # 安装dig命令
yum install -y net-tools                    # 安装ifconfig命令
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;批量下载文件&quot;&gt;※批量下载文件※&lt;/h3&gt;

&lt;p&gt;把需要下载的链接放入一个文本文件，一行一个，然后执行以下命令&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;name &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat &lt;/span&gt;filelist.txt&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do &lt;/span&gt;curl &lt;span class=&quot;nt&quot;&gt;-O&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;done&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;更多命令&lt;/strong&gt; &lt;a href=&quot;https://linux265.com/course/linux-commands.html&quot;&gt;linux命令分类&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>《教育综合》</title>
   <link href="https://comeround.cn/article/jiao-zong.html"/>
   <updated>2021-04-18T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/jiao-zong</id>
   <content type="html">&lt;style&gt;p{margin-bottom: 0px;margin-top: 3px;}pre code{color:#333;}
p img{margin:auto;}
p img:hover{padding:2px;box-shadow:10px 10px 5px #888888;}
.highlight{background-color:#f3f3f3!important;}
blockquote {
    line-height: inherit;
    padding: 15px 15px 15px 1rem;
    font-size: 0.9em;
    color: #2c2c2f;
    border-left-width: 5px;
    border-left-color: rgb(100, 149, 237);
    background: rgb(227, 242, 253);
    overflow: auto;
    word-break: normal;
    margin: 1em 0;
}
blockquote::before{
    display: none;
}
code.highlighter-rouge {
    color: #219863;
    padding: 1px;
    background-color: #fff;
    border: 0px;
    margin: 1px;
    border-radius: 0px;
    font-size: 100%;
    font-weight: 550;
    border-radius: 2px;
}
p&gt;del {
    text-decoration: none;
    background-color: #CD9B1D;
    color: #fff;
    padding: 4px 5px;
    border-radius: 2px;
}
p&gt;em {
    text-decoration: none;
    background-color: #8B658B;
    color: #fff;
    padding: 4px 5px;
    font-style: normal;
    border-radius: 2px;
}
p&gt;strong&gt;em {
    text-decoration: none;
    background-color: #EE6363;
    color: #fff;
    padding: 4px 5px;
    font-style: normal;
    font-weight: 500;
    border-radius: 2px;
}
&lt;/style&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;此文档已移动到 http://wiki.fe80.cn/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;blockquote&gt;
  &lt;p&gt;目录&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#一教育学&quot;&gt;教育学&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#二普通心理学&quot;&gt;普通心理学&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#三教育心理学&quot;&gt;教育心理学&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;一教育学&quot;&gt;一、教育学&lt;/h2&gt;

&lt;h3 id=&quot;教育的产生与发展&quot;&gt;教育的产生与发展&lt;/h3&gt;

&lt;h4 id=&quot;教育的由来&quot;&gt;教育的由来&lt;/h4&gt;

&lt;p&gt;一人一书一句话：孟子《孟子·尽心上》 得天下英才而&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;教育&lt;/code&gt;之&lt;/p&gt;

&lt;h4 id=&quot;教育的定义&quot;&gt;教育的定义&lt;/h4&gt;

&lt;p&gt;广义：家庭教育、学校教育、社会教育&lt;/p&gt;

&lt;p&gt;狭义：学校教育，更狭义：德育&lt;/p&gt;

&lt;h4 id=&quot;教育的基本因素&quot;&gt;教育的基本因素&lt;/h4&gt;

&lt;p&gt;教育者-主导、受教育者-主体、教育影响&lt;/p&gt;

&lt;h4 id=&quot;教育的本质属性&quot;&gt;教育的本质属性&lt;/h4&gt;

&lt;p&gt;教育是有目的培养人的社会活动&lt;/p&gt;

&lt;h4 id=&quot;教育的社会属性&quot;&gt;教育的社会属性&lt;/h4&gt;

&lt;blockquote&gt;
  &lt;p&gt;永历民生长相接济&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
  &lt;li&gt;永恒性：人在教育在&lt;/li&gt;
  &lt;li&gt;历史性：古今不同&lt;/li&gt;
  &lt;li&gt;长期性：“十年树木，百年树人”，育人的周期长&lt;/li&gt;
  &lt;li&gt;相对独立性：
    &lt;ul&gt;
      &lt;li&gt;（1）转化活动&lt;/li&gt;
      &lt;li&gt;（2）历史继承性-古今相同&lt;/li&gt;
      &lt;li&gt;（3）不平衡性，超前于或者落后于社会的发展&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;生产性：潜在的投资&lt;/li&gt;
  &lt;li&gt;民族性：不同民族的教育不同&lt;/li&gt;
  &lt;li&gt;阶级性：社会主义接班人*&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;教育的功能&quot;&gt;教育的功能&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;作用对象：个体发展功能(本体功能、固有功能)、社会发展功能(派生功能、正经文科人)&lt;/li&gt;
  &lt;li&gt;作用方向：正向功能、负向功能&lt;/li&gt;
  &lt;li&gt;呈现形式：显性功能、隐性功能&lt;/li&gt;
  &lt;li&gt;性质：保守功能(重复之前的发展模式)、超越功能(更新创造)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;教育的起源学说&quot;&gt;教育的起源学说&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;神话起源学说：朱熹，不老神话朱熹&lt;/li&gt;
  &lt;li&gt;生物起源学说：利托尔诺、沛西能，本能生利息&lt;/li&gt;
  &lt;li&gt;心理起源说：孟禄，心理仿孟禄&lt;/li&gt;
  &lt;li&gt;劳动起源说：米丁斯基、凯洛夫，米凯爱劳动&lt;/li&gt;
  &lt;li&gt;需要起源说：杨贤江，贤江多需要&lt;/li&gt;
  &lt;li&gt;交往起源说：叶澜，叶澜想交往&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;教育的发展历程&quot;&gt;教育的发展历程&lt;/h4&gt;

&lt;h5 id=&quot;原始社会的教育特点简单-劳动-无级&quot;&gt;原始社会的教育特点：简单 劳动 无级&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;自发性、广泛性、无等级性、无阶级性&lt;/li&gt;
  &lt;li&gt;教育在生产劳动中进行&lt;/li&gt;
  &lt;li&gt;教育内容简单，教育方法单一&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;古代社会教育的发展&quot;&gt;古代社会教育的发展&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;奴隶社会：礼乐射御书数
    &lt;ul&gt;
      &lt;li&gt;夏朝：庠 序 校，出现了中国最早的学校教育形态&lt;/li&gt;
      &lt;li&gt;商朝：瞽宗、庠、序、大学、小学&lt;/li&gt;
      &lt;li&gt;西周：国学、乡学，学在官府(唯官有学)、政教合一&lt;/li&gt;
      &lt;li&gt;春秋：私学兴起，自由办学、自由就学、自由讲学、自由竞争&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;封建社会：四书五经（梦中论大）
    &lt;ul&gt;
      &lt;li&gt;战国：稷下学宫（官家举办、私家主持，学术自由，待遇优厚）&lt;/li&gt;
      &lt;li&gt;西汉：罢黜百家独尊儒术bà chù bǎi jiā ，dú zūn rú shù&lt;/li&gt;
      &lt;li&gt;东汉：太学、洪都们学，察举制、征辟制&lt;/li&gt;
      &lt;li&gt;魏晋南北朝：国子学、太学，九品中正制&lt;/li&gt;
      &lt;li&gt;隋唐：六学二馆，科举制、隋炀帝设进士科&lt;/li&gt;
      &lt;li&gt;宋元：书院（非官非私）&lt;/li&gt;
      &lt;li&gt;明清：八股取士、1905废除科举制&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;西方古代社会教育的发展&quot;&gt;西方古代社会教育的发展&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;奴隶社会
    &lt;ul&gt;
      &lt;li&gt;古埃及：宫廷学校(贵族，有史以来记载最早的学校)、僧侣学校(寺庙学校，学术中心)、职官学校、文士学校(设置最多的学校)&lt;/li&gt;
      &lt;li&gt;古印度：婆罗门教(婆罗门、刹帝利、吠舍、首陀罗，吠陀，古儒学校-家庭教育)、佛教(佛教经典，寺院为主要教育场所)&lt;/li&gt;
      &lt;li&gt;古希腊：斯巴达-军人武士-尚武-重视女子教育、雅典-政治家 商人-崇文&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;封建社会
    &lt;ul&gt;
      &lt;li&gt;中世纪：教会学校-七艺-三科四学、骑士学校-骑士七技-骑马、游泳、击剑、打猎、投枪、下棋、吟诗&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;ul&gt;
    &lt;li&gt;三科：文法、修辞、辩证法；&lt;br /&gt;&lt;/li&gt;
    &lt;li&gt;四学：算数、几何、天文、音乐&lt;br /&gt;&lt;/li&gt;
    &lt;li&gt;马（骑马）永（游泳）建（击剑）是猎（打猎）枪（投枪）骑（下棋）士（吟诗）&lt;br /&gt;&lt;/li&gt;
    &lt;li&gt;马永建是猎枪骑士”。“马”对应骑马；“永”对应游泳；“建”对应击剑；“猎”对应打猎；“枪”对应投枪；“骑”对应下棋；“士”对应吟诗。&lt;br /&gt;&lt;/li&gt;
    &lt;li&gt;骑士学校主要以家庭教育的形式出现&lt;/li&gt;
  &lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h4 id=&quot;教育的总体特征&quot;&gt;教育的总体特征&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;古代教育的总体特征【劳教脱离有阶级】
    &lt;ul&gt;
      &lt;li&gt;古代产生了学校：脑体分工、经验积累、文字、国家的产生&lt;/li&gt;
      &lt;li&gt;教育与生产劳动相脱离：劳心者治人、劳力者治于人；万般皆下品 惟有读书高；樊迟问稼&lt;/li&gt;
      &lt;li&gt;阶级性、等级性：奴隶社会、封建社会&lt;/li&gt;
      &lt;li&gt;道统性、专制型、刻板性、象征性&lt;/li&gt;
      &lt;li&gt;学校教育初步发展&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;近现代教育的总体特征【义务教育世俗化】
    &lt;ul&gt;
      &lt;li&gt;近代教育的特征：国家加强了对教育的重视和干预，公立教育崛起；初等义务教育普遍实施；教育的世俗化；教育的法制化&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
  &lt;p&gt;【劳教脱离有阶级】即生产劳动和教育脱离，简称为脑体分工。注意脑体分离出现在古代社会，给这句话要能反选。阶级即等级性、阶级性，要能区分两者。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4 id=&quot;20世纪以后的教育特征全民多现身&quot;&gt;20世纪以后的教育特征【全民多现身】&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;终身化：影响最大、传播最广、最具生命力的教育思潮（之父：保罗朗格朗）&lt;/li&gt;
  &lt;li&gt;全民化：面向所有人开放&lt;/li&gt;
  &lt;li&gt;民主化：教育机会(起点、过程、结果)；自由化 -机会平等&lt;/li&gt;
  &lt;li&gt;多元化：目标、形式、管理、内容、标准等&lt;/li&gt;
  &lt;li&gt;现代化：科学技术、设备、手段等，核心目标是追求人的现代化，关键是实现教师队伍的现代化&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;教育学的产生与发展&quot;&gt;教育学的产生与发展&lt;/h3&gt;

&lt;h4 id=&quot;教育学概述&quot;&gt;教育学概述&lt;/h4&gt;

&lt;p&gt;教育学是以教育现象、教育问题为研究对象，不断…&lt;/p&gt;

&lt;h4 id=&quot;教育学的萌芽阶段-中国&quot;&gt;教育学的萌芽阶段-中国&lt;/h4&gt;

&lt;p&gt;儒墨教育思想：孔子、孟子、荀子、墨子&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;孔子：人性论-性相近也、习相远也&lt;/li&gt;
  &lt;li&gt;孟子：性善盈科进&lt;/li&gt;
  &lt;li&gt;荀子：&lt;/li&gt;
  &lt;li&gt;墨子：&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;学记&quot;&gt;《学记》&lt;/h4&gt;

&lt;p&gt;作者：乐正克&lt;/p&gt;

&lt;p&gt;地位：世界最早、教育问题&lt;/p&gt;

&lt;p&gt;思想：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;教育与政治：
启发性：道而弗牵、强而弗抑、开而弗达
循序渐进：
课内课外相结合：
及时施教：
教学相长、长善救失
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;教育学的萌芽阶段-外国&quot;&gt;教育学的萌芽阶段-外国&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;苏格拉底&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;柏拉图的老师，道德培养，第一次将算数、几何、天文列为必须学习的科目，产婆术：讽刺、助产术、问答法、归纳和定义。&lt;/p&gt;

&lt;p&gt;产婆术的过程：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;讽刺。让人感到无知。&lt;/li&gt;
  &lt;li&gt;通过一步步助产，得出结论。&lt;/li&gt;
  &lt;li&gt;进行归纳和定义。&lt;/li&gt;
  &lt;li&gt;另外一个版本（由于翻译不同）：讽刺、定义、助产。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;柏拉图&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;亚里士多德的老师，理想国、寓学习于游戏&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;亚里士多德&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;百科全书式的哲学家，《论灵魂》，“教育遵循自然”&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;昆体良&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;《论演说家的教育》（雄辩术原理），欧洲古代教育理论的最高成就，班级授课制的萌芽&lt;/p&gt;

&lt;h4 id=&quot;教育学的创立阶段&quot;&gt;教育学的创立阶段&lt;/h4&gt;

&lt;h5 id=&quot;创立派&quot;&gt;创立派&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;培根&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;科学归纳法第一人，首次提出“教育学”应作为&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;夸美纽斯&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;夸的独立与大泛，班级百科循自然&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;教育学之父&lt;/p&gt;

&lt;p&gt;1632年《大教学论》《母育学校》论述学前教育的专著&lt;/p&gt;

&lt;p&gt;《世界图解》儿童插图教科书&lt;/p&gt;

&lt;p&gt;主要教学原则：（直系巩自量）直观性、系统性、量力性、巩固性、自觉性&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;赫尔巴特&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;杜威&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;培根首提出、纽斯来实现、巴特来规范、杜威真现代&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5 id=&quot;自然派&quot;&gt;自然派&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;卢梭&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;爱弥儿、自然主义思想&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;洛克&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;白板说&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;斯宾塞&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;赞可夫&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;瓦根舍因&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;布鲁纳&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;苏霍姆林斯基&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;布鲁姆&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;巴班&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;裴斯泰洛齐&lt;/strong&gt;&lt;/p&gt;

&lt;h5 id=&quot;其他派&quot;&gt;其他派&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;克鲁普斯卡娅&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;凯洛夫&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;马卡连柯&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;杨贤江&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id=&quot;教育与人的发展&quot;&gt;教育与人的发展&lt;/h3&gt;

&lt;h4 id=&quot;个人身心发展的规律&quot;&gt;个人身心发展的规律&lt;/h4&gt;

&lt;h5 id=&quot;五规律简述个体身心发展的一般规律&quot;&gt;五规律：简述个体身心发展的一般规律：&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;个体身心发展具有顺序性。它是一个由低级到高级、由简单到复杂的 连续不断的发展过程。&lt;/li&gt;
  &lt;li&gt;个体身心发展具有阶段性。不同的年龄阶段面临着不同的发展任务。&lt;/li&gt;
  &lt;li&gt;个体身心发展具有不平衡性。个体的发展并不总是按相同的速度直线 前进的。（同一方面不同速、不同方面不同步，抓关键期）&lt;/li&gt;
  &lt;li&gt;个体身心发展具有互补性。这种互补既体现在身体机能和身体机能之 间，也体现在身体机能和心理机能之间。&lt;/li&gt;
  &lt;li&gt;个体身心发展具有个别差异性。有的人早慧，有的人大器晚成，这种差异体现在群体和群体之间以及 个体和个体之间。&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;二动因&quot;&gt;二动因：&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;内发论：来自人自身的内在需要、遗传决定论。孟子复活迅高歌（孟子、弗洛伊德、威尔逊、格赛尔、霍尔）&lt;/li&gt;
  &lt;li&gt;外铄论：依靠外在力量。外婆寻找落花生（荀子、洛克、华生）&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;四因素遗传环境学校教育主观能动性&quot;&gt;四因素：遗传、环境、学校教育、主观能动性&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;学校教育&lt;/li&gt;
  &lt;li&gt;学校教育在人的身心发展中起主导作用：三有一训练、控制影响全面&lt;/li&gt;
  &lt;li&gt;有目的、有计划、有组织&lt;/li&gt;
  &lt;li&gt;训练&lt;/li&gt;
  &lt;li&gt;控制&lt;/li&gt;
  &lt;li&gt;影响比较全面&lt;/li&gt;
  &lt;li&gt;学校教育对个体发挥在那的特殊功能：严（延时）规范，塑（加速发展）个性&lt;/li&gt;
  &lt;li&gt;做出社会性规范&lt;/li&gt;
  &lt;li&gt;加速个体发展&lt;/li&gt;
  &lt;li&gt;及时和延时的价值&lt;/li&gt;
  &lt;li&gt;发展个性的功能&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;教育与社会发展&quot;&gt;教育与社会发展&lt;/h3&gt;

&lt;h5 id=&quot;教育与生产力的关系&quot;&gt;教育与生产力的关系&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;生产力对教育的制约作用—决定教育的发展水平（两决定、一途径:教育是劳动力再生产的基本途径）龟速够防守
    &lt;ul&gt;
      &lt;li&gt;决定教育的速度和规模（两决定）&lt;/li&gt;
      &lt;li&gt;制约着人才培养的规格和教育结构&lt;/li&gt;
      &lt;li&gt;制约着教学的内容、方法、组织形式和手段&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;教育对生产力的促进作用—经济功能（两再一新促生产）
    &lt;ul&gt;
      &lt;li&gt;劳动力再生产的基本途径&lt;/li&gt;
      &lt;li&gt;科学知识再生产的最有效形式&lt;/li&gt;
      &lt;li&gt;进行技术创新的一个重要手段&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;教育与社会政治经济制度的关系&quot;&gt;教育与社会政治经济制度的关系&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;政治经济制度对教育的制约作用：五决定一途径(体内性质两权一亩地)
    &lt;ul&gt;
      &lt;li&gt;1.社会政治经济制度的性质决定着教育的性质&lt;/li&gt;
      &lt;li&gt;2.社会政治经济制度决定教育的宗旨与目的&lt;/li&gt;
      &lt;li&gt;3.社会政治经济制度决定教育的领导权&lt;/li&gt;
      &lt;li&gt;4.社会政治经济制度决定受教育权&lt;/li&gt;
      &lt;li&gt;5.社会政治经济制度决定着教育内容和教育管理体制&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;教育对政治经济制度的影响作用：人鱼公主促政治（人才、舆论）
    &lt;ul&gt;
      &lt;li&gt;培养所需人才&lt;/li&gt;
      &lt;li&gt;社会舆论&lt;/li&gt;
      &lt;li&gt;民主-政治民主化&lt;/li&gt;
      &lt;li&gt;政治-政治社会化&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;教育与文化的关系&quot;&gt;教育与文化的关系&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;教育对文化发展的促进作用：两传选新促文化（传递、传播、选择、更新）
    &lt;ul&gt;
      &lt;li&gt;传递和保存文化的功能&lt;/li&gt;
      &lt;li&gt;传播交流和丰富文化的功能&lt;/li&gt;
      &lt;li&gt;选择、提升文化的功能（取其精华去其糟粕）&lt;/li&gt;
      &lt;li&gt;更新、创造文化的功能&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;教育目的&quot;&gt;教育目的&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;教育目的的层次结构：普遍与特殊的关系、抽象与具体的关系
    &lt;ul&gt;
      &lt;li&gt;（普遍）国家的教育目的&lt;/li&gt;
      &lt;li&gt;（特殊）学校的培养目标&lt;/li&gt;
      &lt;li&gt;（抽象）课程目标&lt;/li&gt;
      &lt;li&gt;（具体）教师的教学目标：具有操作性&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;教育目的的功能：导向功能、激励功能、评价功能&lt;/li&gt;
  &lt;li&gt;教育目的的理论，（本位的意思是以什么为中心）
    &lt;ul&gt;
      &lt;li&gt;宗教本位论&lt;/li&gt;
      &lt;li&gt;社会本位论：社会、公民为主
        &lt;ul&gt;
          &lt;li&gt;赫尔巴特、柏拉图、孔德、涂尔干、凯兴斯泰纳（那社会恐吓图图）&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;个人本位论：个体、自然人
        &lt;ul&gt;
          &lt;li&gt;卢梭、罗杰斯、福禄贝尔、裴斯泰洛齐（夫人太啰嗦/啰嗦人福禄齐/啰嗦一路无人陪）&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;教育无目的论：杜威&lt;/li&gt;
      &lt;li&gt;辩证统一论&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;我国的教育目的
    &lt;ul&gt;
      &lt;li&gt;社会主义方向&lt;/li&gt;
      &lt;li&gt;全面发展的建设者和接班人&lt;/li&gt;
      &lt;li&gt;提高民族素质&lt;/li&gt;
      &lt;li&gt;培养人才&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;我国教育目的确立的理论依据：社会、人、马克思（马克思是社会人）&lt;/li&gt;
  &lt;li&gt;全面发展教育：德智体美劳&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;教育制度&quot;&gt;教育制度&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;西方：双欧单美分苏联&lt;/li&gt;
  &lt;li&gt;我国：人颁布、鬼实施、丑男女有资本、长期嘘美国&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;义务教育：1986强免普&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;制度化教育，教育制度在形式上的
    &lt;ul&gt;
      &lt;li&gt;前制度化教育&lt;/li&gt;
      &lt;li&gt;制度化教育&lt;/li&gt;
      &lt;li&gt;非制度化教育（超越、打破学校的围墙）&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;课程&quot;&gt;课程&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;含义&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;广义的：教育内容的总和及进程安排&lt;/li&gt;
  &lt;li&gt;狭义的：是指某一门学科&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;课程的类型：&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;分科课程、综合课程与活动课程&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;必修课程与选修课程&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;国家课程、地方课程与校本课程&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;显性课程与隐性课程&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;按照任务分类&lt;/p&gt;
    &lt;ul&gt;
      &lt;li&gt;基础型课程&lt;/li&gt;
      &lt;li&gt;拓展型课程：拓宽视野，如阅读课外读物。&lt;/li&gt;
      &lt;li&gt;研究型课程：主要培养探究能力。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;课程理论流派&quot;&gt;课程理论流派&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;学科中心课程论：赫尔巴特，以学科逻辑体系为核心，主张分科教学&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;活动中心课程论：杜威，以儿童活动为中心，符合学生的心理需要和兴趣&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;社会中心课程论：以社会问题为中心&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;课程层次理论：古德莱德，理想的课程、正式的课程（由教育行政部门发布的）、领悟、运作、经验&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;制约课程开发的因素-二级简答学生在社会上学知识&quot;&gt;制约课程开发的因素 二级简答：学生在社会上学知识&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;学生：年龄特征、知识、能力基础及其可接受性&lt;/li&gt;
  &lt;li&gt;社会：政治经济制度和发展水平对课程开发的硬性&lt;/li&gt;
  &lt;li&gt;学科知识：&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;课程设计的概念：制定课程标准、选择和组织课程内容、安排合成学习活动方式的活动&lt;/p&gt;

&lt;p&gt;课程设计的模式：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;目标模式：泰勒，确定目标、选择经验、组织经验、评价结果（重点）&lt;/li&gt;
  &lt;li&gt;过程模式：斯腾豪斯，关注过程，鼓励探索&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;课程内容组织形式：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;纵向组织和横向组织&lt;/li&gt;
  &lt;li&gt;逻辑顺序和心理顺序&lt;/li&gt;
  &lt;li&gt;☆直线式（不重复）和螺旋式（内容重复出现）&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;教学&quot;&gt;教学&lt;/h3&gt;

&lt;h5 id=&quot;教学过程的基本规律舰长传教&quot;&gt;教学过程的基本规律：舰长传教&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;直接经验与间接经验相统一的规律&lt;/li&gt;
  &lt;li&gt;掌握知识与发展能力相统一的规律&lt;/li&gt;
  &lt;li&gt;教师主导与学生主体相统一的规律&lt;/li&gt;
  &lt;li&gt;传授知识与思想教育相统一的规律&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;教学过程的基本阶段的结构急领老公巩孕运检机灵巩运查&quot;&gt;教学过程的基本阶段（的结构）：急领老公（巩）孕（运）检/机灵巩运查&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;激发学习动机&lt;/li&gt;
  &lt;li&gt;领会知识&lt;/li&gt;
  &lt;li&gt;巩固知识&lt;/li&gt;
  &lt;li&gt;运用知识&lt;/li&gt;
  &lt;li&gt;检查知识&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;教学工作的基本环节背上做导学&quot;&gt;教学工作的基本环节：背上做导学&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;备课：教材、学生、教法 （前提）&lt;/li&gt;
  &lt;li&gt;上课（中心）&lt;/li&gt;
  &lt;li&gt;课外作业布置与批改&lt;/li&gt;
  &lt;li&gt;课外辅导&lt;/li&gt;
  &lt;li&gt;学业成绩检查与评定&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;我国中学教学原则冯巩找阴因凉量寻循思理直发&quot;&gt;我国中学教学原则：冯巩找阴（因）凉（量），寻（循）思理直发&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;直观性原则&lt;/li&gt;
  &lt;li&gt;启发性原则&lt;/li&gt;
  &lt;li&gt;巩固性原则&lt;/li&gt;
  &lt;li&gt;循序渐进原则&lt;/li&gt;
  &lt;li&gt;因材施教原则&lt;/li&gt;
  &lt;li&gt;理论联系实际原则&lt;/li&gt;
  &lt;li&gt;科学性与思想性相统一原则&lt;/li&gt;
  &lt;li&gt;量力性原则&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;教学方法&quot;&gt;教学方法：&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;语言传递：讲授法、谈话法、讨论法、读书指导法&lt;/li&gt;
  &lt;li&gt;直观感知：演示法、参观法&lt;/li&gt;
  &lt;li&gt;实际训练：练习法、实验法、实习作业法、实践活动法&lt;/li&gt;
  &lt;li&gt;情感陶冶：欣赏教学法、情景教学法&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;教学方法选用的依据一课程二师生三教学&quot;&gt;教学方法选用的依据：一课程二师生三教学&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;教学目的和任务的要求&lt;/li&gt;
  &lt;li&gt;课程的性质和特点&lt;/li&gt;
  &lt;li&gt;学生的年龄特征&lt;/li&gt;
  &lt;li&gt;教学实践、设备、条件&lt;/li&gt;
  &lt;li&gt;教师业务水平、实际经验及个性特点&lt;/li&gt;
  &lt;li&gt;教学手段、教学环境等因素&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;教学组织形式&quot;&gt;教学组织形式：&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;个别教学制&lt;/li&gt;
  &lt;li&gt;班级授课制&lt;/li&gt;
  &lt;li&gt;分组教学&lt;/li&gt;
  &lt;li&gt;设计教学法和：老师指导下学生自己决定自己学习的内容&lt;/li&gt;
  &lt;li&gt;道尔顿制：&lt;/li&gt;
  &lt;li&gt;特朗普制（大班上课，小班研究，个别教学-大小个、特灵活）、&lt;/li&gt;
  &lt;li&gt;翻转课堂：在家学，在课堂答疑解惑&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;教学评价&quot;&gt;教学评价&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;诊断性评价：开始、摸底考试&lt;/li&gt;
  &lt;li&gt;形成性评价：过程中、随堂提问&lt;/li&gt;
  &lt;li&gt;总结性评价：结束之后、期终考试&lt;/li&gt;
  &lt;li&gt;相对性评价：常模参照性评价，与人比，目的是选拔人才，高考、公考&lt;/li&gt;
  &lt;li&gt;绝对性评价：合格类考试、学业水平考试&lt;/li&gt;
  &lt;li&gt;个体内差异评价：与自己的过去与现在比&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;德育&quot;&gt;德育&lt;/h3&gt;

&lt;h5 id=&quot;促进中学生形成良好品德的方法p258简答演讲小说定价榜&quot;&gt;促进中学生形成良好品德的方法（P258）简答：演讲小说定价榜&lt;/h5&gt;
&lt;ol&gt;
  &lt;li&gt;有效的说服&lt;/li&gt;
  &lt;li&gt;树立良好的榜样&lt;/li&gt;
  &lt;li&gt;利用群体约定&lt;/li&gt;
  &lt;li&gt;价值辨析&lt;/li&gt;
  &lt;li&gt;给予适当的奖励和惩罚&lt;/li&gt;
  &lt;li&gt;角色扮演&lt;/li&gt;
  &lt;li&gt;小组道德讨论&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;皮亚杰的道德发展阶段论对偶故事法皮偶10岁分水岭&quot;&gt;皮亚杰的道德发展阶段论：对偶故事法（皮偶）10岁分水岭&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;前道德阶段：&lt;/li&gt;
  &lt;li&gt;权威阶段：也叫他律道德阶段，服从外部规则，重行为结果&lt;/li&gt;
  &lt;li&gt;可逆性阶段：也叫自律阶段，要求平等&lt;/li&gt;
  &lt;li&gt;公正阶段&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;科尔伯格的道德发展阶段论三水平六阶段道德两难故事法柯南海因兹偷药&quot;&gt;科尔伯格的道德发展阶段论：三水平六阶段、道德两难故事法（柯南）海因兹偷药&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;前习俗水平
    &lt;ul&gt;
      &lt;li&gt;惩罚与服从道德定向阶段：避免惩罚&lt;/li&gt;
      &lt;li&gt;相对功利道德的定向阶段：满足自己的需求&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;习俗水平
    &lt;ul&gt;
      &lt;li&gt;寻求认可定向阶段：好孩子，别人的赞赏&lt;/li&gt;
      &lt;li&gt;维护权威和秩序定向阶段：知法懂法守法&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;后习俗水平
    &lt;ul&gt;
      &lt;li&gt;社会契约定向阶段：法律可变&lt;/li&gt;
      &lt;li&gt;普遍原则的道德定向阶段：公正、平等、尊严&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;德育过程的基本规律一级简答&quot;&gt;德育过程的基本规律【一级简答】&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;1.德育过程是具有多种开端的对学生知、情、意、行的培养提高过程&lt;/li&gt;
  &lt;li&gt;2.德育过程是促使学生思想内部矛盾运动的过程&lt;/li&gt;
  &lt;li&gt;3.德育过程是组织学生的活动和交往，对学生多方面教育影响的过程&lt;/li&gt;
  &lt;li&gt;4.德育过程是一个长期的、反复的、不断前进的过程&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;德育原则陶行知集体疏导一连学生积极守纪律才有尊严陶行知集体疏导一连学生积极守纪律才有尊严&quot;&gt;德育原则：陶行知集体疏导一连学生、积极守纪律才有尊严=陶行知集体疏导一连学生，积极守纪律才有尊严&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;1.导向性原则（理想性和方向性）&lt;/li&gt;
  &lt;li&gt;2.疏导原则（循循善诱，以理服人；讲明道理、因势利导、表扬激励为主）&lt;/li&gt;
  &lt;li&gt;3.尊重与严格要求相结合（尊重+严格）&lt;/li&gt;
  &lt;li&gt;4.知行统一原则（言行一致）&lt;/li&gt;
  &lt;li&gt;5.正面教育与纪律约束相结合（正面+约束）&lt;/li&gt;
  &lt;li&gt;6.依靠积极因素，克服消极因素（长善救失）&lt;/li&gt;
  &lt;li&gt;7.教育影响的一致性与连贯性（学校+家庭+社会 三方合力）&lt;/li&gt;
  &lt;li&gt;8.因材施教原则（个性差异）&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;中学德育的途径和方法&quot;&gt;中学德育的途径和方法&lt;/h5&gt;
&lt;p&gt;&lt;strong&gt;途径：（口诀：一教二班三活）&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;思想品德课与其他学科教学&lt;/li&gt;
  &lt;li&gt;社会实践活动&lt;/li&gt;
  &lt;li&gt;课外活动&lt;/li&gt;
  &lt;li&gt;共青团组织活动&lt;/li&gt;
  &lt;li&gt;班会、校会、周会、晨会&lt;/li&gt;
  &lt;li&gt;班主任工作&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;方法：（榜样陶说品德段子）（说实情、评示道）&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;说服教育法：摆事实、讲道理；语言说服、事实说服&lt;/li&gt;
  &lt;li&gt;榜样示范法：高尚思想、模范行为、优异成就，桃李不言下自成蹊&lt;/li&gt;
  &lt;li&gt;陶冶情操法：人格感化、环境陶冶、艺术陶冶&lt;/li&gt;
  &lt;li&gt;实际锻炼法：常规训练、实践锻炼&lt;/li&gt;
  &lt;li&gt;品德评价法：奖励、惩罚、评比、操行评定&lt;/li&gt;
  &lt;li&gt;道德修养法：自我反省&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;班主任&quot;&gt;班主任&lt;/h3&gt;

&lt;h5 id=&quot;班主任的工作内容及方法常规工作&quot;&gt;班主任的工作内容及方法（常规工作）&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;了解及研究学生：前提和基础，观察法&lt;/li&gt;
  &lt;li&gt;组织和培养班集体：班主任工作的中心环节&lt;/li&gt;
  &lt;li&gt;建立学生成长档案：收集、整理、鉴定、保管&lt;/li&gt;
  &lt;li&gt;组织班会活动和课外活动&lt;/li&gt;
  &lt;li&gt;协调各种教育影响：学校内部、学校与家庭、学校与社会&lt;/li&gt;
  &lt;li&gt;操行评定&lt;/li&gt;
  &lt;li&gt;写好班主任工作计划与总结&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;个别教育工作&quot;&gt;个别教育工作&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;优等生：严格要求，防止自满；提交抗挫折能力&lt;/li&gt;
  &lt;li&gt;中等生：信息不足&lt;/li&gt;
  &lt;li&gt;后进生心理特征：学习动机不强、意志力薄弱、是非观念模糊&lt;/li&gt;
  &lt;li&gt;如何对待后进生（恒心才发光）
    &lt;ul&gt;
      &lt;li&gt;关心热爱和严格要求想结合&lt;/li&gt;
      &lt;li&gt;培养和激发学习动机&lt;/li&gt;
      &lt;li&gt;善于发掘“闪光点”&lt;/li&gt;
      &lt;li&gt;针对差异因材施教&lt;/li&gt;
      &lt;li&gt;持之以恒&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;教师&quot;&gt;教师&lt;/h3&gt;

&lt;h5 id=&quot;教师的劳动特点&quot;&gt;教师的劳动特点&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;复杂性：目的全面、任务多样、对象差异&lt;/li&gt;
  &lt;li&gt;创造性：因材施教、教学方法、教育机智（能够随机应变）&lt;/li&gt;
  &lt;li&gt;连续性：时间的连续&lt;/li&gt;
  &lt;li&gt;广延性：空间不定&lt;/li&gt;
  &lt;li&gt;长期性：周期长，小学6年初中3年，十年树木百年树人&lt;/li&gt;
  &lt;li&gt;间接性：不直接创造物质财富&lt;/li&gt;
  &lt;li&gt;主体性：具有影响&lt;/li&gt;
  &lt;li&gt;示范性：言行举止，以身作则&lt;/li&gt;
  &lt;li&gt;个体性：劳动方式的个体性&lt;/li&gt;
  &lt;li&gt;群体性：成果&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;教师的领导方式&quot;&gt;教师的领导方式&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;强硬专断型：严加监视、很少给予表扬&lt;/li&gt;
  &lt;li&gt;仁慈专断型：表扬关心学生、以自己作为班级一切工作的标准&lt;/li&gt;
  &lt;li&gt;放任自流型：不鼓励、不反对&lt;/li&gt;
  &lt;li&gt;民主型：合作、平等、鼓励&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;教师成长心理的成长历程&quot;&gt;教师成长心理的成长历程&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;关注生存：关注教师自身及人际关系&lt;/li&gt;
  &lt;li&gt;关注情境：关注学生学习成绩、备课&lt;/li&gt;
  &lt;li&gt;关注学生：关注学生的个别差异&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;教师成长与发展的基本途径一级&quot;&gt;教师成长与发展的基本途径【一级】&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;观摩和分析优秀教师的教学活动（看别人）&lt;/li&gt;
  &lt;li&gt;开发微格教学（看自己）&lt;/li&gt;
  &lt;li&gt;进行专门训练（多训练）&lt;/li&gt;
  &lt;li&gt;反思教学经验（多反思）&lt;/li&gt;
  &lt;li&gt;总结：波斯纳：经验+反思=成长；布鲁巴奇：反思日记、详细描述、交流讨论、行动研究&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;教师的心理健康&quot;&gt;教师的心理健康&lt;/h5&gt;
&lt;ul&gt;
  &lt;li&gt;职业倦怠：长期的职业压力作用下，对自己产生怀疑
    &lt;ul&gt;
      &lt;li&gt;情绪耗竭：累+没热情、葛优躺&lt;/li&gt;
      &lt;li&gt;去人性化：冷漠、消极、否定、不关心学生&lt;/li&gt;
      &lt;li&gt;个人成就感低：贬低自己的工作价值，最糟糕&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;影响教师心理健康的因素
    &lt;ul&gt;
      &lt;li&gt;社会因素：工资、地位&lt;/li&gt;
      &lt;li&gt;组织因素：学校单位人际关系&lt;/li&gt;
      &lt;li&gt;个人因素：性格&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;学校管理&quot;&gt;学校管理&lt;/h3&gt;

&lt;h2 id=&quot;二普通心理学&quot;&gt;二、普通心理学&lt;/h2&gt;

&lt;h4 id=&quot;心理学概述&quot;&gt;心理学概述&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;概念&lt;/strong&gt; 心理学是研究心理现象及其发生规律的科学。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;结构&lt;/strong&gt; 心理现象非常复杂，从形式上归为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;心理过程&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;个性心理&lt;/code&gt;两个方面。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;心理现象&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;心理过程（共性）注意
    &lt;ul&gt;
      &lt;li&gt;认知过程：感觉、知觉、记忆、思维、想象&lt;/li&gt;
      &lt;li&gt;情绪情感过程：情绪、情感&lt;/li&gt;
      &lt;li&gt;意志过程：意志&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;个性心理
    &lt;ul&gt;
      &lt;li&gt;个性倾向性：需要、动机、兴趣、理想、价值观、信念&lt;/li&gt;
      &lt;li&gt;个性心理特征：能力、性格、气质&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;心理学主要流派&quot;&gt;心理学主要流派&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;构造主义心理学&lt;/li&gt;
  &lt;li&gt;机能主义心理学&lt;/li&gt;
  &lt;li&gt;格式塔心理学&lt;/li&gt;
  &lt;li&gt;行为主义心理学&lt;/li&gt;
  &lt;li&gt;现代认知心理学&lt;/li&gt;
  &lt;li&gt;人本主义心理学&lt;/li&gt;
  &lt;li&gt;精神分析学派&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;认知过程&quot;&gt;认知过程&lt;/h3&gt;

&lt;p&gt;感觉、知觉、记忆、思维、想象&lt;/p&gt;

&lt;h4 id=&quot;感知觉&quot;&gt;感知觉&lt;/h4&gt;

&lt;h5 id=&quot;感觉&quot;&gt;感觉&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;概念&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;对直接作用于感觉器官的客观事物的个别属性的反应。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;种类&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;外部感觉（视听嗅味肤）
    &lt;ul&gt;
      &lt;li&gt;视觉&lt;/li&gt;
      &lt;li&gt;听觉&lt;/li&gt;
      &lt;li&gt;嗅觉&lt;/li&gt;
      &lt;li&gt;味觉&lt;/li&gt;
      &lt;li&gt;肤觉&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;内部感觉
    &lt;ul&gt;
      &lt;li&gt;机体觉&lt;/li&gt;
      &lt;li&gt;平衡觉&lt;/li&gt;
      &lt;li&gt;运动觉&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;一般规律&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;绝对感受性：感觉出最小刺激量的能力&lt;/li&gt;
  &lt;li&gt;差别感受性：感觉出最小差别的能力&lt;/li&gt;
  &lt;li&gt;绝对感觉阈限：刚刚能引起感受的最小强度&lt;/li&gt;
  &lt;li&gt;差别感觉阈限：刚刚能引起差别感觉的最小差异&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;感觉的相互作用&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;感觉适应&lt;/li&gt;
  &lt;li&gt;感觉对比&lt;/li&gt;
  &lt;li&gt;感觉后效&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;知觉&quot;&gt;知觉&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;概念&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;对客观事物整理属性的反应。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;种类&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;空间知觉&lt;/li&gt;
  &lt;li&gt;时间知觉&lt;/li&gt;
  &lt;li&gt;运动知觉&lt;/li&gt;
  &lt;li&gt;错觉&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;整体特征&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;选择性&lt;/li&gt;
  &lt;li&gt;恒常性&lt;/li&gt;
  &lt;li&gt;理解性&lt;/li&gt;
  &lt;li&gt;整体性&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;观察&quot;&gt;观察&lt;/h5&gt;

&lt;h4 id=&quot;记忆&quot;&gt;记忆&lt;/h4&gt;

&lt;h5 id=&quot;记忆的概述&quot;&gt;记忆的概述&lt;/h5&gt;

&lt;h5 id=&quot;记忆过程&quot;&gt;记忆过程&lt;/h5&gt;

&lt;h5 id=&quot;记忆规律在教学中的应用&quot;&gt;记忆规律在教学中的应用&lt;/h5&gt;

&lt;h5 id=&quot;学生记忆的发展&quot;&gt;学生记忆的发展&lt;/h5&gt;

&lt;h4 id=&quot;表象与想象&quot;&gt;表象与想象&lt;/h4&gt;

&lt;h4 id=&quot;言语与思维&quot;&gt;言语与思维&lt;/h4&gt;

&lt;h4 id=&quot;注意&quot;&gt;注意&lt;/h4&gt;

&lt;h5 id=&quot;注意的概述&quot;&gt;注意的概述&lt;/h5&gt;

&lt;h5 id=&quot;注意的规律&quot;&gt;注意的规律&lt;/h5&gt;

&lt;h5 id=&quot;注意规律在教学中的应用&quot;&gt;注意规律在教学中的应用&lt;/h5&gt;

&lt;h3 id=&quot;情绪情感-意志过程&quot;&gt;情绪情感 意志过程&lt;/h3&gt;

&lt;h4 id=&quot;情绪和情感&quot;&gt;情绪和情感&lt;/h4&gt;

&lt;h4 id=&quot;意志过程&quot;&gt;意志过程&lt;/h4&gt;

&lt;h5 id=&quot;意志概述&quot;&gt;意志概述&lt;/h5&gt;

&lt;h3 id=&quot;心理发展与教育&quot;&gt;心理发展与教育&lt;/h3&gt;

&lt;h3 id=&quot;学习及其理论&quot;&gt;学习及其理论&lt;/h3&gt;

&lt;h3 id=&quot;学习理论&quot;&gt;学习理论&lt;/h3&gt;

&lt;h3 id=&quot;学习动机&quot;&gt;学习动机&lt;/h3&gt;

&lt;h3 id=&quot;知识的学习&quot;&gt;知识的学习&lt;/h3&gt;

&lt;h3 id=&quot;技能的形成&quot;&gt;技能的形成&lt;/h3&gt;

&lt;h3 id=&quot;学习策略及其教学&quot;&gt;学习策略及其教学&lt;/h3&gt;

&lt;p&gt;注意策略；精细加工策略；复述策略；编码与组织策略&lt;/p&gt;

&lt;p&gt;元认知及其作用；元认知策略&lt;/p&gt;

&lt;p&gt;时间管理策略；努力管理策略；学业求助策略&lt;/p&gt;

&lt;h3 id=&quot;问题解决能力与创造性的培养&quot;&gt;问题解决能力与创造性的培养&lt;/h3&gt;

&lt;h3 id=&quot;社会规范学习与品德发展&quot;&gt;社会规范学习与品德发展&lt;/h3&gt;

&lt;h3 id=&quot;心理健康及其教育&quot;&gt;心理健康及其教育&lt;/h3&gt;

&lt;h2 id=&quot;三教育心理学&quot;&gt;三、教育心理学&lt;/h2&gt;

&lt;h4 id=&quot;教育心理学的基本内涵&quot;&gt;教育心理学的基本内涵&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;研究对象&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;研究教育教学情境中学与教的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;基本心理规律&lt;/code&gt;的科学。它拥有独特的研究课题，即&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;如何学、如何教&lt;/code&gt;以及&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;学与教之间的相互作用&lt;/code&gt;。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;学科性质&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;教育学和心理学的交叉学科。（并不是普通心理学在教育领域的简单应用）&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;自然科学与人文科学的交叉。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;理论性与应用性并重。&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;教育心理学的研究内容&quot;&gt;教育心理学的研究内容&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;五要素&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;学生：①学习的主体，最主要的研究对象；②群体差异，年龄、性别、社会文化；③个体差异，知识基础、学习方式、智力水平、兴趣、需要&lt;/li&gt;
  &lt;li&gt;教师：主导，关键&lt;/li&gt;
  &lt;li&gt;教学内容：知识、技能、策略、态度、价值观&lt;/li&gt;
  &lt;li&gt;教学媒体：载体、工具&lt;/li&gt;
  &lt;li&gt;教学环境：物质环境、社会环境&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
  &lt;p&gt;口诀：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;教师&lt;/code&gt;在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;教学环境&lt;/code&gt;中用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;教学媒体&lt;/code&gt;教&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;学生教学内容&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;三过程&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;学习过程（核心）&lt;/li&gt;
  &lt;li&gt;教学过程&lt;/li&gt;
  &lt;li&gt;评价/反思过程&lt;/li&gt;
&lt;/ol&gt;

&lt;h5 id=&quot;皮亚杰认知发展阶段理论和教育&quot;&gt;皮亚杰认知发展阶段理论和教育&lt;/h5&gt;

&lt;blockquote&gt;
  &lt;p&gt;271敢签巨星&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5 id=&quot;维果斯基的心理发展观与教育&quot;&gt;维果斯基的心理发展观与教育&lt;/h5&gt;

&lt;p&gt;文化历史发展理论&lt;/p&gt;

&lt;p&gt;内化学说&lt;/p&gt;

&lt;p&gt;最近发展区&lt;/p&gt;

&lt;h5 id=&quot;埃里克森的社会文化发展理论的主要观点&quot;&gt;埃里克森的社会文化发展理论的主要观点&lt;/h5&gt;

&lt;p&gt;婴儿期、儿童早起、学前期、学龄期、青年期、成年早起、成年中期、成年晚期&lt;/p&gt;

&lt;h5 id=&quot;自我意识的发展&quot;&gt;自我意识的发展&lt;/h5&gt;

&lt;p&gt;自我认识、自我体验、自我监控；生理自我、社会自我、心理自我&lt;/p&gt;

&lt;h5 id=&quot;个别差异&quot;&gt;个别差异&lt;/h5&gt;

&lt;p&gt;场独立型、场依存型&lt;/p&gt;

&lt;p&gt;沉思型、冲动型&lt;/p&gt;

&lt;p&gt;辅合型、发散型&lt;/p&gt;

&lt;h3 id=&quot;学习的基本理论&quot;&gt;学习的基本理论&lt;/h3&gt;

&lt;h5 id=&quot;学习的分类&quot;&gt;学习的分类&lt;/h5&gt;

&lt;p&gt;加涅：言语学习、智慧技能、认知策略、态度、动作技能。&lt;/p&gt;

&lt;p&gt;奥苏贝尔：接受学习和发现学习、机械学习和有意义学习。&lt;/p&gt;

&lt;p&gt;我国学者：只是的学习、技能的学习、道德品质、行为习惯。&lt;/p&gt;

&lt;h4 id=&quot;一般学习理论&quot;&gt;一般学习理论&lt;/h4&gt;

&lt;h5 id=&quot;行为主义学习理论&quot;&gt;行为主义学习理论&lt;/h5&gt;

&lt;p&gt;（1）桑代克：尝试错误说；&lt;/p&gt;

&lt;p&gt;（2）巴普洛夫：经典性条件作用理论&lt;/p&gt;

&lt;p&gt;（3）斯金纳的操作性条件作用论&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;正强化：给予一个愉快的刺激
负强化：摆脱厌恶刺激
惩罚：呈现一个厌恶刺激
消退：无任何强化物
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（4）班杜拉的社会学习理论&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;直接强化：
替代强化：
自我强化：
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;认知学习理论&quot;&gt;认知学习理论&lt;/h4&gt;

&lt;p&gt;（1）科勒的完形-顿悟说&lt;/p&gt;

&lt;p&gt;（2）托尔曼的符号学习理论&lt;/p&gt;

&lt;p&gt;（3）布鲁纳的认知结构学习理论&lt;/p&gt;

&lt;p&gt;（4）奥苏贝尔的有意义接受学习&lt;/p&gt;

&lt;h2 id=&quot;五新课改&quot;&gt;五、新课改&lt;/h2&gt;

&lt;h2 id=&quot;五教育法律法规&quot;&gt;五、教育法律法规&lt;/h2&gt;

&lt;h2 id=&quot;六教师职业道德&quot;&gt;六、教师职业道德&lt;/h2&gt;

&lt;h4 id=&quot;教师职业道德概述&quot;&gt;教师职业道德概述&lt;/h4&gt;

&lt;h5 id=&quot;教师职业道德的功能&quot;&gt;教师职业道德的功能&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;动力功能&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;调节功能&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;教育功能&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;评价功能&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;师范功能&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;引导功能&lt;/strong&gt;&lt;/p&gt;

&lt;h5 id=&quot;教师职业道德的特点&quot;&gt;教师职业道德的特点&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;全局性&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;从教师的社会责任来看，师德具有全局性&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;超前性&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;从社会地位来看，师德具有超前性&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;导向性&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;从教师职业及个人素质来看，师德具有导向性&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;示范性&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;从教师的人格评价来看，师德具有超越一般职业道德的示范性&lt;/p&gt;

&lt;h5 id=&quot;教师职业道德的基本构成&quot;&gt;教师职业道德的基本构成&lt;/h5&gt;

&lt;ol&gt;
  &lt;li&gt;教师职业理想&lt;/li&gt;
  &lt;li&gt;教师职业责任&lt;/li&gt;
  &lt;li&gt;教师职业态度&lt;/li&gt;
  &lt;li&gt;教师职业纪律&lt;/li&gt;
  &lt;li&gt;教师职业技能&lt;/li&gt;
  &lt;li&gt;教师职业良心&lt;/li&gt;
  &lt;li&gt;教师职业作风&lt;/li&gt;
  &lt;li&gt;教师职业荣誉&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;教师职业道德的范畴&quot;&gt;教师职业道德的范畴&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;教师义务&lt;/li&gt;
  &lt;li&gt;教师良心&lt;/li&gt;
  &lt;li&gt;教师荣誉&lt;/li&gt;
  &lt;li&gt;教师幸福&lt;/li&gt;
  &lt;li&gt;教师人格&lt;/li&gt;
  &lt;li&gt;教师威信&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;教师职业道德规范&quot;&gt;教师职业道德规范&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;“爱国守法”–教师职业道德的基本要求&lt;/li&gt;
  &lt;li&gt;“爱岗敬业”–教师职业的本质要求&lt;/li&gt;
  &lt;li&gt;“关爱学生”–师德的灵魂&lt;/li&gt;
  &lt;li&gt;“教书育人”–教师天职&lt;/li&gt;
  &lt;li&gt;“为人师表”–教师职业的内在要求&lt;/li&gt;
  &lt;li&gt;“终身学习”–教师专业发展的不竭动力&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;七教育教学技能&quot;&gt;七、教育教学技能&lt;/h2&gt;

&lt;h3 id=&quot;教育技术学&quot;&gt;教育技术学&lt;/h3&gt;

&lt;h3 id=&quot;教材教法&quot;&gt;教材教法&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/uploads/2021/12281_dog.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;教育技术学&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;del&gt;教材教法&lt;/del&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;这里是文字&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;教育技术学&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;教材教法&lt;/code&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Go-Gin之接口开发</title>
   <link href="https://comeround.cn/article/go-gin.html"/>
   <updated>2021-04-01T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/go-gin</id>
   <content type="html">&lt;h6 id=&quot;go-gin学习笔记&quot;&gt;Go-gin学习笔记&lt;/h6&gt;

&lt;blockquote&gt;
  &lt;p&gt;请移步其他技术文档&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://gin-gonic.com/zh-cn/docs/quickstart/&quot;&gt;Gin Web Fram快速入门&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://gorm.io/zh_CN/docs/&quot;&gt;GORM&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.topgoer.com/&quot;&gt;topgoer&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://hao.studygolang.com/&quot;&gt;studygolang&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;报错解决问题集
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;https://blog.csdn.net/cwcmcw/article/details/107347245&quot;&gt;working directory is not part of a module&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;代码段&quot;&gt;代码段&lt;/h2&gt;

&lt;h3 id=&quot;1渲染模板&quot;&gt;（1）渲染模板&lt;/h3&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;gin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;LoadHTMLGlob&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;templates/**/*&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/home/index&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HTML&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;StatusOK&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;home/index.tmpl&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;gin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;H&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;s&quot;&gt;&quot;title&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Users&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
	&lt;span class=&quot;c&quot;&gt;// 模板文件位于 templates/home/index.tmpl&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;若报错，模板头部需要加&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{⋅{ define &quot;home/index.tmpl&quot; }}&lt;/code&gt;、尾部&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{⋅{ end }}&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;2http相关&quot;&gt;（2）HTTP相关&lt;/h3&gt;

&lt;h4 id=&quot;请求方式&quot;&gt;请求方式&lt;/h4&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;//GET&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;//POST&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;PostForm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;//设置默认值&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;page&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DefaultQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;page&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;上传文件&quot;&gt;上传文件&lt;/h4&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;//import (&quot;net/http&quot; &quot;github.com/gin-gonic/gin&quot; &quot;time&quot; &quot;fmt&quot; &quot;path&quot; &quot;log&quot;)&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;//r.MaxMultipartMemory = 8 &amp;lt;&amp;lt; 20&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;POST&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/upload&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;c&quot;&gt;// 单文件&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FormFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;file&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	
	&lt;span class=&quot;n&quot;&gt;dst&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;./uploads&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;c&quot;&gt;// 上传文件至指定目录&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;SaveUploadedFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dst&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

	&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dst&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

	&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;StatusOK&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sprintf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&apos;%s&apos; uploaded!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;重定向&quot;&gt;重定向&lt;/h4&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/test&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;c&quot;&gt;// 301重定向&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Redirect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;StatusMovedPermanently&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;http://www.alibaba.com/&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;POST&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/test2&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;c&quot;&gt;// 302重定向&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Redirect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;StatusFound&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/foo&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;// 内部重定向&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/test&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/test2&quot;&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HandleContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GET&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/test2&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;gin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;H&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;world&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;静态文件&quot;&gt;静态文件&lt;/h4&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Static&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/assets&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;./assets&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;//r.StaticFS(&quot;/more_static&quot;, http.Dir(&quot;my_file_system&quot;))&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;StaticFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/favicon.ico&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;./assets/favicon.ico&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;3数据库&quot;&gt;（3）数据库&lt;/h3&gt;

&lt;h4 id=&quot;数据库连接&quot;&gt;数据库连接&lt;/h4&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
	&lt;span class=&quot;s&quot;&gt;&quot;fmt&quot;&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;github.com/go-sql-driver/mysql&quot;&lt;/span&gt;
	&lt;span class=&quot;s&quot;&gt;&quot;github.com/spf13/viper&quot;&lt;/span&gt;
	&lt;span class=&quot;s&quot;&gt;&quot;gorm.io/driver/mysql&quot;&lt;/span&gt;
	&lt;span class=&quot;s&quot;&gt;&quot;gorm.io/gorm&quot;&lt;/span&gt;
	&lt;span class=&quot;s&quot;&gt;&quot;net/url&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DB&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gorm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DB&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;InitDB&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gorm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DB&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;host&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;viper&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GetString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;datasource.host&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;port&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;viper&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;datasource.port&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;database&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;viper&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GetString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;datasource.database&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;username&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;viper&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GetString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;datasource.username&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;viper&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GetString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;datasource.password&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;charset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;viper&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GetString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;datasource.charset&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;loc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;viper&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GetString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;datasource.loc&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sprintf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;%s:%s@tcp(%s:%s)/%s?charset=%s&amp;amp;parseTime=true&amp;amp;loc=%s&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;username&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;database&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;charset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;QueryEscape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;loc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;gorm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mysql&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gorm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{})&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;nb&quot;&gt;panic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;databases_error:&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;DB&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;db&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;db&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;数据库查询&quot;&gt;数据库查询&lt;/h4&gt;

&lt;div class=&quot;language-go highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;// 增&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;acco&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AdminUser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;Phone&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;     &lt;span class=&quot;s&quot;&gt;&quot;16522223336&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;User_name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;uauauaua&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;Password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;  &lt;span class=&quot;s&quot;&gt;&quot;uauauauauauauauauauauauauauauauau&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;util&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DB&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;acco&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;// 改&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;upr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;util&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DB&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;phone = ?&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;18600007360&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Updates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AdminUser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;User_name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;66699&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;upr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;RowsAffected&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;c&quot;&gt;// 修改成功&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;// 删&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;der&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;util&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DB&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;phone = ?&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;16522223333&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Delete&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AdminUser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{})&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;der&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;RowsAffected&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;c&quot;&gt;// 删除成功&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;// 查&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;admin_users&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AdminUser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{}&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;util&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DB&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Find&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;admin_users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;http://www.topgoer.com/%E6%95%B0%E6%8D%AE%E5%BA%93%E6%93%8D%E4%BD%9C/gorm/CRUD%E6%8E%A5%E5%8F%A3/&quot;&gt;GORM参考&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>ZX IPv6地址数据库之C#解析</title>
   <link href="https://comeround.cn/article/zxinc-ipv6-csharp-sdk.html"/>
   <updated>2021-03-04T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/zxinc-ipv6-csharp-sdk</id>
   <content type="html">&lt;h2 id=&quot;一zx-ipv6地址数据库是什么&quot;&gt;一、ZX IPv6地址数据库是什么&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;http://ip.zxinc.org/&quot;&gt;首页&lt;/a&gt; | &lt;a href=&quot;http://ip.zxinc.org/ipquery/&quot;&gt;查询接口&lt;/a&gt; | &lt;a href=&quot;/article/ipv6-address.html&quot;&gt;IPv6地址分配概览&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;二数据库格式解析&quot;&gt;二、数据库格式解析&lt;/h2&gt;

&lt;h3 id=&quot;文件格式详解&quot;&gt;文件格式详解&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;每行16字节(128bit)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;0123 4567 89ab cdef 0123 4567 89ab cdef # 列标号 0-15字节
---- ---- ---- ---- ---- ---- ---- ----
4950 4442 0100 0308 4d28 0200 0000 0000 # `4950 4442`为`IPDB`;`0100`版本号2; 03 偏移地址长度
                                        # `08`IP地址长度 `4d28 0200`记录数 77+40*256+2*256*256=141389
cfb2 0800 0000 0000 0000 0000 0000 0000 # `cfb2 0800 0000 0000`索引区第一条记录的偏移207+178*256+8*256*256=570063
2800 0000 0000 0000 3230 3230 3035 3036 # `2800 0000 0000 0000`数据库版本字符串的偏移`40字节`
                                        # `3230 3230`开始之后就是正式的数据了
0049 414e 41e4 bf9d e795 99e5 9cb0 e59d
8000 0049 414e 41e7 89b9 e6ae 8ae5 9cb0
e59d 8000 e58c 85e5 90ab 7634 e59c b0e5
9d80 e79a 8476 36e5 9cb0 e59d 8000 0243
0000 e4bb 85e7 94a8 e4ba 8ee4 b8a2 e5bc
83e7 9a84 e59c b0e5 9d80 0002 4300 00e6
9caa e79f a5e5 9cb0 e59d 8000 0243 0000

# 以下是特殊的解码方法
928c e4b8 ade5 9bbd e6b2 b3e5 8c97 e79c # `e4b8 ade5 9bbd`中国;`e6b2 b3e5 8c97`河北
----
0638 030e 24d2 0c08 0000 0008 3803 0e24 # `0000 0008 3803 0e24` 240e:0338:0800:0000
da0c 0800 0000 0a38 030e 24e2 0c08 0000 # `da 0c08` 地址索引218+12*256+8*256*256=527578
0638 030e 24d2 0c08 0000 0008 3803 0e24
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;文件头
0~3	字符串	&quot;IPDB&quot;
4-5	short	版本号,现在是2。版本号0x01到0xFF之间保证互相兼容。
6	byte	偏移地址长度(2~8)
7	byte	IP地址长度(4或8或12或16, 现在只支持4(ipv4)和8(ipv6))
8~15	int64	记录数
16-23	int64	索引区第一条记录的偏移
24	byte	地址字段数(1~255)[版本咕咕咕新增,现阶段默认为2]
25-31	reserve	保留,用00填充
32~39	int64	数据库版本字符串的偏移[版本2新增,版本1没有]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;该二进制文件的结构为&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;40字节文件头&lt;/li&gt;
  &lt;li&gt;地址库(49B到569454B)&lt;/li&gt;
  &lt;li&gt;ISP库(84B到570010B)&lt;/li&gt;
  &lt;li&gt;IP库(141389*11字节,570063B到2125331B)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;文件读取流程详解&quot;&gt;文件读取流程详解&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;二分法查找&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1~141389&lt;/code&gt;，查找到对应的IPv6位置，该IPv6为起始地址，下一地址减1为结束地址&lt;/li&gt;
  &lt;li&gt;IPv6后面保存有地址的位置&lt;/li&gt;
  &lt;li&gt;位置
    &lt;ul&gt;
      &lt;li&gt;真实地址：1字节表示地址是否重定向
        &lt;ul&gt;
          &lt;li&gt;2为重定向，后面3字节为重定向地址&lt;/li&gt;
          &lt;li&gt;如果没有重定向，直接读取文字，知道遇到0&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;运营商：
        &lt;ul&gt;
          &lt;li&gt;如果真实地址重定向了，那么位置为原位置+4&lt;/li&gt;
          &lt;li&gt;如果没有重定向，那么位置为1+真实地址的长度&lt;/li&gt;
          &lt;li&gt;得到运营商的位置之后，相同道理获取运营商的文字&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;例如&quot;&gt;例如：&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;IP地址：2409:896a:40:df6:2310:359c:4ef7:ad32&lt;/li&gt;
  &lt;li&gt;编号：50736&lt;/li&gt;
  &lt;li&gt;位点：1128159,1128170(下一个位点) 2409:896a::,2409:896a:1ff:ffff::&lt;/li&gt;
  &lt;li&gt;记录地址：483045 ip_record_offset&lt;/li&gt;
  &lt;li&gt;第一个flag 2代表重定向 ， 412607，读取重定向后的文字得到”中国贵州省贵阳市南明区”&lt;/li&gt;
  &lt;li&gt;运营商：483049 重定向到465669 “中国移动CMNET网络”&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;三文件读写&quot;&gt;三、文件读写&lt;/h2&gt;

&lt;h3 id=&quot;读文件&quot;&gt;读文件&lt;/h3&gt;

&lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dbFile&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;[文件路径]&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;FileStream&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;FileStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dbFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FileMode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;OpenOrCreate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FileAccess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ReadWrite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Seek&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SeekOrigin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Begin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//偏移字节数(修改文件指针)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Read&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//读取字节并写入到bytes中&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Flush&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;写文件&quot;&gt;写文件&lt;/h3&gt;

&lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dbFile&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;[文件路径]&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;FileStream&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;FileStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dbFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FileMode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;OpenOrCreate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FileAccess&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ReadWrite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;文件指针：&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Flush&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[文件路径]&lt;/code&gt;的文件内容将会变成写入的内容&lt;/p&gt;

&lt;h2 id=&quot;四c解析&quot;&gt;四、C#解析&lt;/h2&gt;

&lt;h3 id=&quot;1从文件中读取任意字节&quot;&gt;（1）从文件中读取任意字节&lt;/h3&gt;

&lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// 读数据：size字节&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;param name=&quot;seek&quot;&amp;gt;位置偏移量&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;param name=&quot;size&quot;&amp;gt;需要数据长度&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;returns&amp;gt;byte[]&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;seek&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;seek0&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;seek&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;seek&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Read&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;2从文件中读取自定义字节并转换成数字&quot;&gt;（2）从文件中读取自定义字节并转换成数字&lt;/h3&gt;

&lt;div class=&quot;language-cs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// 读数据：3字节的数字&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;param name=&quot;seek&quot;&amp;gt;位置偏移量&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;param name=&quot;size&quot;&amp;gt;需要数据长度&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;read3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;seek&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;seek&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;seek&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;seek&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Read&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;256&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;256&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;五生成exe查询工具&quot;&gt;五、生成EXE查询工具&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2021/zxinc-csharp-query-tool.png&quot; alt=&quot;IPv6查询工具&quot; /&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;下载&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;/public/blog/2021/ZXIPv6-query-tool.zip&quot;&gt;IPv6查询工具&lt;/a&gt;&lt;/p&gt;

&lt;h6 id=&quot;总结&quot;&gt;总结：&lt;/h6&gt;

&lt;p&gt;（1）按字节读取数据&lt;/p&gt;

&lt;p&gt;（2）字节数据转换成数字，是从左到右&lt;/p&gt;

&lt;p&gt;例如：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;804020&lt;/code&gt; 转换过程为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;80 + 40 * 256 + 20 * 256 * 256&lt;/code&gt;&lt;/p&gt;

&lt;h6 id=&quot;参考资料&quot;&gt;参考资料&lt;/h6&gt;

&lt;p&gt;&lt;a href=&quot;https://gitee.com/lionsoul/ip2region/tree/master/maker/csharp/src/IP2RegionDotNetDbMaker&quot;&gt;狮子的魂/ip2region(C#解析二进制文件)&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>文件更新工具</title>
   <link href="https://comeround.cn/article/upyun-blog-client.html"/>
   <updated>2021-01-24T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/upyun-blog-client</id>
   <content type="html">&lt;style&gt;
    .post&gt;p{text-indent:2em;}
    .post&gt;p&gt;img{height:300px;margin:10px auto;}
&lt;/style&gt;

&lt;blockquote&gt;
  &lt;p&gt;前3节是基于又拍云提供的接口做出的文件上传工具，由于又拍云不提供listObjects接口及文件的etag值，所以后面把该工具改成了多吉云/腾讯云的文件更新工具，增加了文件md5对比，减少资源消耗。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;一控制台版本工具-又拍云20210124&quot;&gt;一、控制台版本工具-又拍云(2021/01/24)&lt;/h2&gt;

&lt;h3 id=&quot;1开发语言及环境&quot;&gt;（1）开发语言及环境：&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;语言：C#控制台&lt;/li&gt;
  &lt;li&gt;框架：.net framework 4.8&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2021/up-store-01.png&quot; alt=&quot;项目文件夹&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;2使用步骤&quot;&gt;（2）使用步骤&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;输入要上传的路径&lt;/li&gt;
  &lt;li&gt;输入bucket、操作员账号、密码&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2021/up-store-02.png&quot; alt=&quot;输入路径及账号密码&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;3上传完成后查看又拍云存储&quot;&gt;（3）上传完成后查看又拍云存储&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2021/up-store-03.png&quot; alt=&quot;完成后&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;4访问网站&quot;&gt;（4）访问网站&lt;/h3&gt;

&lt;p&gt;网站文件上传后，使用浏览器访问又拍云提供的域名或者自定义域名，即可访问到刚刚上传的网站。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;控制台应用程序v0.1&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;输入本地路径、账号、密码、存储桶，并全量更新&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;二winform应用程序-又拍云20210128&quot;&gt;二、winform应用程序-又拍云(2021/01/28)&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2021/up-store-04.png&quot; alt=&quot;完成后&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;窗体应用程序v0.2&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;自动检测文件是否改动，文件没有改动则不自动上传，减少工作负载；&lt;/li&gt;
  &lt;li&gt;自动保存路径、Bucket、账号、密码到用户目录下，下次打开无需重新填写；&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;三wpf应用程序-又拍云20210218&quot;&gt;三、WPF应用程序-又拍云(2021/02/18)&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2021/up-store-05.png&quot; alt=&quot;WPF应用程序&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;窗体应用程序v0.3.0 (2021/02/18)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;窗体应用程序v0.3.1 (2021/05/13)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;功能和winform应用程序一样，使用xml保存账号数据；&lt;/li&gt;
  &lt;li&gt;优化界面；&lt;/li&gt;
  &lt;li&gt;支持多项目、随时保存；&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;四wpf应用程序-多吉云腾讯云20210607&quot;&gt;四、WPF应用程序-多吉云/腾讯云(2021/06/07)&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;程序特点：&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;拉取存储上的文件列表和文件的Etag值；&lt;/li&gt;
  &lt;li&gt;现有文件和本地文件一一做对比，不重复上传文件；&lt;/li&gt;
  &lt;li&gt;多余现有文件将会被删除；&lt;/li&gt;
  &lt;li&gt;保存更新日志，可查看文件变动情况；&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2021/doge-uploader.png&quot; alt=&quot;完成后&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;blockquote&gt;
  &lt;p&gt;下载方式：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p style=&quot;text-decoration: line-through;background-color: #fff;&quot;&gt;WPF应用程序下载地址：[点我下载](/public/blog/2021/UPClient-v0.3.1.zip)&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>高中信息技术面试课题</title>
   <link href="https://comeround.cn/article/gao-xin.html"/>
   <updated>2020-12-31T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/gao-xin</id>
   <content type="html">&lt;style type=&quot;text/css&quot;&gt;
.post&gt;p {
    text-indent: 2em;
    margin-bottom: 10px;
}
.post&gt;p&gt;strong {
    margin-left: -24px;
}
.post&gt;blockquote{
    color: #ccc;
}
del{
    text-decoration: line-through;
    background-color: #fff;
}
.post&gt;h3{
    margin-top: 72px;
}
.post&gt;table td,th{
    text-align: center;
}
.post&gt;table tbody tr:hover{
    background-color: #fff!important;
}
.post&gt;table tbody td:hover{
    background-color: rgba(0, 136, 204, .06);
}
&lt;/style&gt;

&lt;h6 id=&quot;目录&quot;&gt;目录&lt;/h6&gt;

&lt;table&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;th&gt;分类&lt;/th&gt;
            &lt;th&gt;课题&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        &lt;!-- 信息技术概述 --&gt;
        &lt;tr&gt;
            &lt;td rowspan=&quot;5&quot;&gt;信息技术概述&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;#信息的基本特征&quot;&gt;信息的基本特征&lt;/a&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;a href=&quot;#信息技术的发展历史&quot;&gt;信息技术的发展历史&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;a href=&quot;#搜索引擎的使用&quot;&gt;搜索引擎的使用&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;a href=&quot;#信息加工的一般过程&quot;&gt;信息加工的一般过程&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;a href=&quot;#获取信息的途径&quot;&gt;获取信息的途径&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;!-- 计算机基础 --&gt;
        &lt;tr&gt;
            &lt;td rowspan=&quot;7&quot;&gt;计算机基础&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;#计算机组成&quot;&gt;计算机组成&lt;/a&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;a href=&quot;#二进制与数制转换&quot;&gt;二进制与数制转换&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;电子邮件及其工作原理&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;数据压缩的基本原理&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;信息处理系统的组件和软件&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;虚拟现实&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;信息资源管理的三个阶段&lt;/td&gt;&lt;/tr&gt;
        &lt;!-- 信息安全 --&gt;
        &lt;tr&gt;
            &lt;td rowspan=&quot;3&quot;&gt;信息安全&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;#信息安全问题&quot;&gt;信息安全问题&lt;/a&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;a href=&quot;#安全使用信息系统&quot;&gt;安全使用信息系统&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;a href=&quot;#计算机病毒及其防御&quot;&gt;计算机病毒及其防御&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;!-- 办公软件的使用 --&gt;
        &lt;tr&gt;
            &lt;td rowspan=&quot;4&quot;&gt;办公软件的使用&lt;/td&gt;
            &lt;td&gt;Word的使用&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt; Excel的使用&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt; PowerPoint的使用&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;数据分析&lt;/td&gt;&lt;/tr&gt;
        &lt;!-- 多媒体技术 --&gt;
        &lt;tr&gt;
            &lt;td rowspan=&quot;6&quot;&gt;多媒体技术&lt;/td&gt;
            &lt;td&gt;多媒体的主要特征&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;a href=&quot;#图像信息的采集与加工&quot;&gt;图像信息的采集与加工&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;音频信息的加工&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;a href=&quot;#视频的采集与加工&quot;&gt;视频的采集与加工&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;动画制作软件flash&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;多媒体作品设计脚本的基本过程&lt;/td&gt;&lt;/tr&gt;
        &lt;!-- 网络技术应用 --&gt;
        &lt;tr&gt;
            &lt;td rowspan=&quot;9&quot;&gt;网络技术应用&lt;/td&gt;
            &lt;td&gt;&lt;a href=&quot;#认识ip&quot;&gt;认识IP&lt;/a&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;因特网的发展&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;IP地址的分类及其管理&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;a href=&quot;#局域网和广域网&quot;&gt;局域网和广域网&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;a href=&quot;#dns域名系统&quot;&gt;DNS域名系统&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;域名的基本结构&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;计算机网络的拓扑结构&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;a href=&quot;#组建无线局域网&quot;&gt;组建无线局域网&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;网页制作html&lt;/td&gt;&lt;/tr&gt;
        &lt;!-- 数据库技术 --&gt;
        &lt;tr&gt;
            &lt;td rowspan=&quot;5&quot;&gt;数据库技术&lt;/td&gt;
            &lt;td&gt;认识数据库&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;使用数据库管理系统的优势&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;select语句（基本结构和操作符）&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;交叉表查询&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;数据库中的报表&lt;/td&gt;&lt;/tr&gt;
        &lt;!-- 程序设计初步 --&gt;
        &lt;tr&gt;
            &lt;td rowspan=&quot;6&quot;&gt;程序设计初步&lt;/td&gt;
            &lt;td&gt;算法描述&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;a href=&quot;#常量变量及表达式&quot;&gt;常量、变量及表达式&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;信息系统开发的四个阶段&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;数组的维度和定义&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;选择排序算法的思路&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;数据库检索原理及SQL语言概述&lt;/td&gt;&lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;信息的基本特征&quot;&gt;信息的基本特征&lt;/h3&gt;

&lt;p&gt;普传功夫真驾驶&lt;/p&gt;

&lt;p&gt;【答题套路】层次+核心+适当解释。&lt;/p&gt;

&lt;p&gt;（1）普遍性：信息是无时不有，无时不在的。&lt;/p&gt;

&lt;p&gt;（2）传递性：信息传递可以打破空间和时间的限制。&lt;/p&gt;

&lt;p&gt;（3）共享性：信息可以被多个接收者接收并加以利用&lt;/p&gt;

&lt;p&gt;（4）依附性：信息不能独立存在，必须有载体，且载体可以不唯一。&lt;/p&gt;

&lt;p&gt;（5）真伪性：并非所有的信息都是对事物的真实反映，因此有真假之分。&lt;/p&gt;

&lt;p&gt;（6）价值性：同一则信息，对不同的人来说，价值不同。&lt;/p&gt;

&lt;p&gt;（7）时效性：同一则信息，在不同的时间内，价值作用也是不同的。&lt;/p&gt;

&lt;h3 id=&quot;信息技术的发展历史&quot;&gt;信息技术的发展历史&lt;/h3&gt;

&lt;p&gt;【记忆口诀】语文印电计&lt;/p&gt;

&lt;p&gt;（1）第一次变革：语言的使用。这是从猿进化到人的标志。&lt;/p&gt;

&lt;p&gt;（2）第二次变革：文字的创造。首次超越时间和空间的限制。&lt;/p&gt;

&lt;p&gt;（3）第三次变革：印刷术的发明。初步实现了广泛的信息共享。&lt;/p&gt;

&lt;p&gt;（4）第四次变革：电报、电话、广播、电视的发明。进一步突破时间和时间的限制。&lt;/p&gt;

&lt;p&gt;（5）第五次变革：计算机技术和现代信息通信技术的应用。至此走进数字化的信息时代。&lt;/p&gt;

&lt;h3 id=&quot;计算机组成&quot;&gt;计算机组成&lt;/h3&gt;

&lt;p&gt;计算机系统主要有硬件系统和软件系统两部分组成。&lt;/p&gt;

&lt;p&gt;其中，硬件系统是计算机的躯壳，主要有运算器、控制器、存储器、输入设备和输出设备组成。运算器和控制器又是中央处理器的核心组成部分；运算器、控制器、内存储器又可以组成了主机；外存储器、输入设备、输出设备可以组成外设。&lt;/p&gt;

&lt;p&gt;软件系统是计算机的灵魂，主要由系统软件和应用软件两部分组成。系统软件主要组成部分包括操作系统、语言处理程序、数据库管理系统等。&lt;/p&gt;

&lt;h3 id=&quot;搜索引擎的使用&quot;&gt;搜索引擎的使用&lt;/h3&gt;

&lt;p&gt;常见的搜索引擎包含三类，分别是全文（关键字）搜索引擎、目录（分类）搜索引擎、元搜索引擎。&lt;/p&gt;

&lt;p&gt;其中，全文搜索引擎的原理是先由服务器端搜集网络中的网页，组建数据库；用户在浏览器界面输入关键字后，服务器根据用户输入的关键字与数据库中的网页进行全文匹配；最后按照匹配的结果进行排序后，反馈至浏览器界面。该搜索引擎的核心特点是范围广、更新及时、查询速度快，但准确性差。&lt;/p&gt;

&lt;p&gt;目录搜索引擎的原理是事先搭建多中分类的目录，由人工审核网站提交的信息（如网站描述关键字），如果通过则归类到相应目录下，用户根据已经建好的目录逐级（先大类再小类）查找信息。其核心特点是范围小、更新不及时、查询速度慢，但准确性高。&lt;/p&gt;

&lt;p&gt;而元搜索引擎没有独立数据库，只是向用户提供搜索界面，然后从其他网站中搜集结果。&lt;/p&gt;

&lt;h3 id=&quot;信息加工的一般过程&quot;&gt;信息加工的一般过程&lt;/h3&gt;

&lt;h3 id=&quot;获取信息的途径&quot;&gt;获取信息的途径&lt;/h3&gt;

&lt;h3 id=&quot;信息安全问题&quot;&gt;信息安全问题&lt;/h3&gt;

&lt;h3 id=&quot;安全使用信息系统&quot;&gt;安全使用信息系统&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;《安全使用信息系统》教案 - 人教版高中信息技术必修二第四单元第一课第三小节&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4 id=&quot;一教学目标&quot;&gt;一、教学目标&lt;/h4&gt;

&lt;p&gt;知识与技能：学生掌握作为普通用户安全使用信息系统的常见防护措施。&lt;/p&gt;

&lt;p&gt;过程与方法：通过教师引导及学生思考、交流，学生意识到个人安全使用信息系统的重要性，能安全地使用信息系统，降低信息安全威胁。&lt;/p&gt;

&lt;p&gt;情感态度与价值观：养成安全、规范的信息系统操作习惯，增强自身的信息安全意识。&lt;/p&gt;

&lt;h4 id=&quot;二教学重难点&quot;&gt;二、教学重难点&lt;/h4&gt;

&lt;p&gt;教学重点：学生知道作为普通用户安全使用信息系统的常见防护措施。&lt;/p&gt;

&lt;p&gt;教学难点：学生养成安全、规范的信息系统操作习惯，增强自身的信息安全意识。&lt;/p&gt;

&lt;h4 id=&quot;三教学过程&quot;&gt;三、教学过程&lt;/h4&gt;

&lt;h5 id=&quot;一导入&quot;&gt;(一)导入&lt;/h5&gt;

&lt;p&gt;谈话导入：首先教师提问学生遇到的信息安全方面的事件，学生可能回答QQ账号被盗、银行卡里的资金不翼而飞、计算机硬盘异常损坏导致里面的文件无法读出、电脑中毒.再引导学生思考作为普通用户我们应该如何做才能尽量避免类似安全事件发生呢?由学生的疑问自然引出本节课的课题。&lt;/p&gt;

&lt;h5 id=&quot;二教授新课&quot;&gt;(二)教授新课&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;1.设置安全的密码&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;(1)教师通过谈话和情景引导学生意识到设置密码的重要性，不能太简单，也不能复杂的自己都忘记。&lt;/p&gt;

&lt;p&gt;之后教师提出如何设置密码。学生先思考，再查看课本分析比较自己的想法和书上设置密码方法的异同，最后学生回答问题。&lt;/p&gt;

&lt;p&gt;(2)教师通过“思考活动”，组织学生进行小组讨论，展示讨论成果，提高学生安全使用密码的意识。教师最后提示我们不仅要设置好密码，使用密码时还要有安全意识。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;设置安全密码&lt;/li&gt;
  &lt;li&gt;设置密保问题&lt;/li&gt;
  &lt;li&gt;绑定手机号码和邮箱&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2.病毒防范&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;教师通过情景引导学生思考如何做好病毒防范工作，学生根据之前的知识经验结合课本思考，并组织学生结合“实践活动”为家中电脑做病毒防范，查杀病毒。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.个人数据的备份&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;(1)教师引导学生意识到数据备份的重要性，初步了解备份的两种方法–本地备份和云备份，再请同学结合课本查看两种备份方法的注意事项，最后组织学生结合“实践活动”备份计算机和手机中的数据。&lt;/p&gt;

&lt;p&gt;(2)学生自主进行阅读拓展，了解废旧设备的处理办法。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.安全使用网络&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;教师通过情景引导学生意识到互联网上的安全隐患，提出接入网络时的注意事项的问题，组织学生结合自身的知识经验先思考，同桌两人再讨论，最后师生一起总结注意事项。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;不在公共电脑保存自己的重要信息，如网吧、学校机房&lt;/li&gt;
  &lt;li&gt;不随意访问短信、邮箱中附带的链接&lt;/li&gt;
  &lt;li&gt;不访问其他网站，以免中毒&lt;/li&gt;
  &lt;li&gt;尽量使用https协议代替http协议上网&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;三练习&quot;&gt;(三)练习&lt;/h5&gt;

&lt;p&gt;请学生们结合思考活动，巩固今天所学知识，并思考其他的安全威胁和个人安全防范应对方法。&lt;/p&gt;

&lt;h5 id=&quot;四小结&quot;&gt;(四)小结&lt;/h5&gt;

&lt;p&gt;组织学生交流并分享本节课的收获，引导学生回忆作为普通用户常用的信息系统安全防范方法，增强自身的信息安全意识。&lt;/p&gt;

&lt;h5 id=&quot;五作业&quot;&gt;(五)作业&lt;/h5&gt;

&lt;p&gt;回家后利用家中计算机和手机等设备，尝试书本上的实践活动。&lt;/p&gt;

&lt;h4 id=&quot;四板书设计&quot;&gt;四、板书设计&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1.设置安全密码
2.病毒的防范
3.个人数据备份
4.安全使用网络
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;计算机病毒及其防御&quot;&gt;计算机病毒及其防御&lt;/h3&gt;

&lt;p&gt;常见的计算机病毒：&lt;/p&gt;

&lt;p&gt;（1）系统病毒&lt;/p&gt;

&lt;p&gt;（2）蠕虫病毒&lt;/p&gt;

&lt;p&gt;（3）木马病毒、黑客病毒&lt;/p&gt;

&lt;p&gt;（4）脚本病毒&lt;/p&gt;

&lt;p&gt;（6）宏病毒&lt;/p&gt;

&lt;p&gt;（7）后门病毒&lt;/p&gt;

&lt;p&gt;（8）破坏性程序病毒、玩笑病毒、捆绑机病毒&lt;/p&gt;

&lt;p&gt;计算机病毒的主要特点：&lt;/p&gt;

&lt;p&gt;（1）寄生性，是指计算机病毒不能单独存在，需要寄生在其他程序中。&lt;/p&gt;

&lt;p&gt;（2）传染性，又称自我复制，程序之间、计算机之间、网络上等。&lt;/p&gt;

&lt;p&gt;（3）隐蔽性，是指病毒发作前需要隐藏起来，不被发现。&lt;/p&gt;

&lt;p&gt;（4）潜伏性，计算机病毒从入侵到其发挥作用中间会有一段时间。&lt;/p&gt;

&lt;p&gt;（5）可触发性，发作的导火索，一般是一个特定时机（如某个时间点、运行程序时等）。&lt;/p&gt;

&lt;p&gt;（6）破坏性，病毒发挥其作用，既可以破坏计算机软件，也有可能破坏计算机硬件。&lt;/p&gt;

&lt;p&gt;（7）不可预见性，用户不知道什么时候出现什么类型的病毒。&lt;/p&gt;

&lt;p&gt;在日常生活中可采用以下方式防治病毒：&lt;/p&gt;

&lt;p&gt;（1）安装正版杀毒软件，杀毒软件经常更新，以快速检测到可能人侵计算机的新病毒或者变种。&lt;/p&gt;

&lt;p&gt;（2）重要文件进行经常性的备份，一旦遭到破坏可及时恢复文件，防止病毒破坏造成重大损失。&lt;/p&gt;

&lt;p&gt;（3）建立良好的安全习惯。不随意接受、打开陌生人发来的电子邮件或通过QQ传递的文件或网址。&lt;/p&gt;

&lt;p&gt;（4）不轻易使用来历不明的光盘、移动磁盘，使用前先杀毒处理，提高安全性。&lt;/p&gt;

&lt;p&gt;（5）计算机发现病毒或异常时，迅速隔离，立刻断网，以防止受到更多感染，同时防止计算机成为传播源。&lt;/p&gt;

&lt;p&gt;（6）使用复杂的密码，提高安全系数。&lt;/p&gt;

&lt;p&gt;（7）了解一些计算机病毒知识，做好预防措施。&lt;/p&gt;

&lt;h3 id=&quot;二进制与数制转换&quot;&gt;二进制与数制转换&lt;/h3&gt;

&lt;p&gt;《二进制与数制转换》教案&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;人教版高中信息技术必修一第一章第二课&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4 id=&quot;一教学目标-1&quot;&gt;一、教学目标&lt;/h4&gt;

&lt;p&gt;知识与技能目标：掌握二进制的基本规则；理解按权展开求和法、除R反向取余法；学会利用方法对二进制与十进制数进行相互转换；了解八进制数和十六进制数的转换。&lt;/p&gt;

&lt;p&gt;过程与方法目标：通过自主探究进制转换的方法；小组合作体验生活中RGB颜色转换数制的过程。&lt;/p&gt;

&lt;p&gt;情感态度与价值观目标：帮助学生建立信息意识；激发学生学习力和思考力；引导学生结合实际举一反三。&lt;/p&gt;

&lt;h4 id=&quot;二教学重难点-1&quot;&gt;二、教学重难点&lt;/h4&gt;

&lt;p&gt;教学重点：掌握二进制的基本规则；学会利用方法对二进制与十进制数进行相互转换。&lt;/p&gt;

&lt;p&gt;教学难点：理解按权展开求和法、除R反向取余法；了解八进制数和十六进制数的转换。&lt;/p&gt;

&lt;h4 id=&quot;三教学过程-1&quot;&gt;三、教学过程&lt;/h4&gt;

&lt;h5 id=&quot;一导入-1&quot;&gt;(一)导入&lt;/h5&gt;

&lt;p&gt;生活实例导入：教师为学生展示日常生活中的两组数据案例，例如二进制数1011和十进制数11。教师提出问题：数据输入计算机后结果一致吗？为什么？激发学生的好奇心。带着问题，教师分别演示两组数据输入到计算机中的结果，请学生观察结果并进行大胆猜想，交流讨论。引导学生往数制转换的方向思考，引入课题。&lt;/p&gt;

&lt;h5 id=&quot;二新授活动&quot;&gt;(二)新授活动&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;1.二进制基本规则&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;(1)教师过渡：为了弄清数据输入计算机后结果一致的原因，首先需要掌握二进制的基本规则。&lt;/p&gt;

&lt;p&gt;(2)教师围绕着两组数据，进行二进制基本规则的讲解：&lt;/p&gt;

&lt;p&gt;①二进制的基数为2，两个基本数码是0和1；&lt;/p&gt;

&lt;p&gt;②采用逢二进一的进位规则，例如1+1=10；&lt;/p&gt;

&lt;p&gt;③不同的数位对应不同的权值，权值用基数的幂表示。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.除2反向取余法、按权展开求和法&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;(1)学生根据二进制的基本规则，结合书本的方法，自主探究十进制数转换二进制数。&lt;/p&gt;

&lt;p&gt;①方法过程：十进制整数转换为二进制数可采用除2反向取余法，即将十进制整数除以2，得到商数和余数，用商数再除以2，依此类推直到商数为0为止，得到的余数按照逆序排列，即为换算的二进制数的结果。②教师巡视指导：重点引导学生注重整除过程准确性和余数逆序排列两个重点和易错点。教师举例演示除2反向取余法并引导学生结合自主探究结果进行互动。(2)学生根据二进制的基本规则，结合书本的方法，自主探究二进制数转换十进制数：&lt;/p&gt;

&lt;p&gt;①方法过程：将二进制数转换成十进制数，常用的方法是按权展开求和。二进制数中每位数字的权是以2为底的幂，按权展开求和。&lt;/p&gt;

&lt;p&gt;②教师巡视指导：重点引导学生注重每位数字的权是以2为底的幂的变化过程。教师举例演示按权展开求和法并引导学生结合自主探究结果进行互动。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.八进制和十六进制数的相关表示规则&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;教师讲授不同进制的右下角标明基数规则和原则并举例说明。&lt;/p&gt;

&lt;p&gt;①右下角标明基数规则：不同的进制，常在数的右下角标明基数。&lt;/p&gt;

&lt;p&gt;②遵循原则：基数是可使用数码符号的数目，R进制的基数就是R，遵循“逢R进一”原则。&lt;/p&gt;

&lt;p&gt;③举例说明：例如，(27) O是八进制数，(FFCC66) 16是 十六进制数。八进制数和十六进制数还可以分别用O (大写字母O，下同)和H (大写字母H，下同)表示，例如27O、FFCC66H。&lt;/p&gt;

&lt;p&gt;4.八进制数、十六进制数的特点&lt;/p&gt;

&lt;p&gt;教师讲授八进制数、十六进制数的特点。&lt;/p&gt;

&lt;p&gt;①八进制数特点：基数为8，逢八进一，1 位八进制数可以用3位二进制数表示。&lt;/p&gt;

&lt;p&gt;②十六进制数特点：基数为16，逢十六进一，1位十六进制数可以用4位二进制数表示。&lt;/p&gt;

&lt;h5 id=&quot;三巩固提高&quot;&gt;(三)巩固提高&lt;/h5&gt;

&lt;p&gt;小组合作体验生活中颜色值RGB (64，224，208)转换十六进制数的过程。&lt;/p&gt;

&lt;p&gt;①学生小组合作：将学生分为三组，每组学生分别对应颜色值RGB (64，224，208)当中的数字64，224，208，对它们进行十六进制数转换。&lt;/p&gt;

&lt;p&gt;②教师巡视指导：引导学生尝试采用不同方法进行转换，提醒学生在计算过程和方法步骤.上严谨细致。③学生交流汇报：分组汇报转换结果，第一组64转换结果为40，使用的是除2反向取余法求二进制数，再将二进制数转换为十六进制数；第二组224转换结果为E0，使用的是除16反向取余法；第三组208转换结果为DO，使用的是除16反向取余法。&lt;/p&gt;

&lt;h5 id=&quot;四总结&quot;&gt;(四)总结&lt;/h5&gt;

&lt;p&gt;总结：师生共同总结所学知识。&lt;/p&gt;

&lt;p&gt;二进制的基本规则；按权展开求和法、除R反向取余法；不同进制的右下角标明基数规则和原则；八进制数、十六进制数的特点。&lt;/p&gt;

&lt;h5 id=&quot;五作业-1&quot;&gt;(五)作业&lt;/h5&gt;

&lt;p&gt;作业：转换身边的数制，将#9400D3、#D2B48C表 示成相对应的RGB颜色值。使用计算器程序，验证上述结果。&lt;/p&gt;

&lt;h4 id=&quot;四板书设计-1&quot;&gt;四、板书设计&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1.二进制的基本规则
2.按权展开求和法
3.除R反向取余法
4.八进制数、十六进制数的特点
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;图像信息的采集与加工&quot;&gt;图像信息的采集与加工&lt;/h3&gt;

&lt;h4 id=&quot;一教学目标-2&quot;&gt;一、教学目标&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;知识与技能：能够独立剪切合成图像，并添加文字、调整背景美化图像。&lt;/li&gt;
  &lt;li&gt;过程与方法：根据实际需要，灵活设置调整图像。&lt;/li&gt;
  &lt;li&gt;情感态度与价值观：通过本节课的学习，提升设计的美感，感受到生活中的美。&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;二教学重难点-2&quot;&gt;二、教学重难点&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;重点：图像的剪切合成，调整文字、背景。&lt;/li&gt;
  &lt;li&gt;难点：根据实际需要，灵活设置调整图像。&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;三教学过程-2&quot;&gt;三、教学过程&lt;/h4&gt;

&lt;h5 id=&quot;一导入新课&quot;&gt;（一）导入新课&lt;/h5&gt;

&lt;p&gt;创设情境：展示作品&lt;/p&gt;

&lt;p&gt;1.教师利用大屏幕呈现图像合成作品，孙悟空和超人的合成照片，提问同学们观看感受。&lt;/p&gt;

&lt;p&gt;2.接下来教师引导同学，的确照片是合成的，提问同学们关于合成照片我们可以利用什么呢?给同学呈现素材照片。&lt;/p&gt;

&lt;p&gt;由此引入本节课的课题一-图像的加工。&lt;/p&gt;

&lt;h5 id=&quot;二教授新课-1&quot;&gt;（二）教授新课&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;任务一：剪切合成图像&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.教师引导学生若要完成简单的图像加工，首先要进行图像的剪切和拼接，从而引出任务- -剪切图像并合成作品。接着教师展示“写意生活”主题相关素材，并利用矩形选取工具对“校园小景”进行图像剪切，然后布置合作探究任务：学生试着用不同的工具完成“篮球”、“街舞”两个素材的剪切，并总结不同工具的特点。&lt;/p&gt;

&lt;p&gt;2.图层命名和图像大小调整布置成自主探究的任务，让同学们结合教材自主完成，并展示作品。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;任务二：添加文字、设置背景&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.关于添加文字的操作，相对来说比较容易，可以通过自主探究的方式，让学生结合刚才所制作的作品进行文字插入和美化o教师提示同学们观察当插入文字之后：图层的变化。&lt;/p&gt;

&lt;p&gt;2.教师提示同学利用渐变工具和画笔工具修饰背景，布置任务：学生之间的小组讨论，合作设置。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;内容范围&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.学生通过尝试利用不同工具完成图像剪切，并能够试着总结出各工具的应用特点，如矩形选取工具：选择对象为图像中的一整块矩形区域。魔棒工具：图像和背景色色差明显，背景色单一，图像便捷清晰。&lt;/p&gt;

&lt;p&gt;磁性套索工具：图像边界清晰，磁性套索工具会自动识，别图像边界，并自动黏附在图像边界上。&lt;/p&gt;

&lt;p&gt;2.学生结合教材自主完成，利用“编辑、变换、缩放”命令调整图像，然后移动工具调整位置，并组内推选优秀作品进行互评。&lt;/p&gt;

&lt;p&gt;3.学生自主操作，利用文字工具进行文字的插入，利用变形文字工具和字符格式工具调整文字。并通过教师的提示，知道文字图层的自动添加。&lt;/p&gt;

&lt;p&gt;4.学生小组内合作，完成美化背景的操作。&lt;/p&gt;

&lt;h5 id=&quot;三巩固练习&quot;&gt;（三）巩固练习&lt;/h5&gt;

&lt;p&gt;巩固练习：布置任务，小组为单位，完成课后实践练习中设置贺卡。学生协作完成，完成后进行作品展示，师生共同评价。&lt;/p&gt;

&lt;p&gt;通过巩固练习的设置，能够检验学生对于本节课知识的掌握情况。&lt;/p&gt;

&lt;h5 id=&quot;四课堂小结&quot;&gt;（四）课堂小结&lt;/h5&gt;

&lt;p&gt;总结：提问学生本节课学习的主要内容。&lt;/p&gt;

&lt;p&gt;作业：课后回顾本节课的知识内容，以及预习下一节课。&lt;/p&gt;

&lt;h5 id=&quot;五布置作业&quot;&gt;（五）布置作业&lt;/h5&gt;

&lt;p&gt;下课之后继续完善自己的作品，使其变得更加丰富多彩，在下节课中继续分享。&lt;/p&gt;

&lt;h4 id=&quot;四板书设计-2&quot;&gt;四、板书设计&lt;/h4&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;板书&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;b&gt;图像信息的加工&lt;/b&gt;&lt;br /&gt;1.图像的裁剪与合成&lt;br /&gt;2.添加文字&lt;br /&gt;3.设置背景&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;视频的采集与加工&quot;&gt;视频的采集与加工&lt;/h3&gt;

&lt;h4 id=&quot;一教学目标-3&quot;&gt;一、教学目标&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;知识与技能：&lt;/li&gt;
  &lt;li&gt;过程与方法：&lt;/li&gt;
  &lt;li&gt;情感态度与价值观：&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;二教学重难点-3&quot;&gt;二、教学重难点&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;重点：掌握视频信息的加工工具一级视频加工的方法。&lt;/li&gt;
  &lt;li&gt;难点：掌握视频导入以及视频添加字幕和背景音乐的操作。&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;三教学过程-3&quot;&gt;三、教学过程&lt;/h4&gt;

&lt;h5 id=&quot;一导入新课-1&quot;&gt;（一）导入新课&lt;/h5&gt;

&lt;p&gt;通过多媒体播放一段自拍并加工的“校园最美课间操”的视频短片，然后给学生展示制作视频的素材&lt;/p&gt;

&lt;h5 id=&quot;二教授新课-2&quot;&gt;（二）教授新课&lt;/h5&gt;

&lt;p&gt;1.视频加工工具&lt;/p&gt;

&lt;p&gt;2.视频信息的简单加工&lt;/p&gt;

&lt;p&gt;3.视频信息的简单合成&lt;/p&gt;

&lt;h5 id=&quot;三巩固练习-1&quot;&gt;（三）巩固练习&lt;/h5&gt;

&lt;p&gt;请学生们利用本节课学习的知识自己到网上下载素材，完成对自己家乡进行宣传的视频，并发送到教师机上，出示“操作评价表”，要求学生互相分享评价。&lt;/p&gt;

&lt;h5 id=&quot;四课堂小结-1&quot;&gt;（四）课堂小结&lt;/h5&gt;

&lt;p&gt;组织学生交流并分享本节课的收获，引导学生进一步明确视频信息采集加工的操作技巧。&lt;/p&gt;

&lt;h5 id=&quot;五布置作业-1&quot;&gt;（五）布置作业&lt;/h5&gt;

&lt;p&gt;下课之后继续完善自己的作品，使其变得更加丰富多彩，在下节课中继续分享。&lt;/p&gt;

&lt;h4 id=&quot;四板书设计-3&quot;&gt;四、板书设计&lt;/h4&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;板书&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;b&gt;视频的采集与加工&lt;/b&gt;&lt;br /&gt;1.视频加工工具&lt;br /&gt;2.视频信息的简单加工&lt;br /&gt;3.视频信息的简单合成&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;认识ip&quot;&gt;认识IP&lt;/h3&gt;

&lt;h4 id=&quot;一教学目标-4&quot;&gt;一、教学目标&lt;/h4&gt;

&lt;p&gt;【知识与技能】&lt;/p&gt;

&lt;p&gt;学生能准确说出IP地址概念；完整复述IP地址格式及分类方法，能通过计算分辨出IP地址的类型。&lt;/p&gt;

&lt;p&gt;【过程与方法】&lt;/p&gt;

&lt;p&gt;学生通过生活实例直观感受IP地址的作用和便捷；通过小组讨论，自主探究掌握 IP地址的分类形式，并能正确辨别IP地址类型。&lt;/p&gt;

&lt;p&gt;【情感态度与价值观】&lt;/p&gt;

&lt;p&gt;学生体验通过计算识别IP地址类型的学习乐趣，在进行自主学习的过程中勇于克服困难，同时提高对网络技术应用的学习兴趣。&lt;/p&gt;

&lt;h4 id=&quot;二教学重难点-4&quot;&gt;二、教学重难点&lt;/h4&gt;

&lt;p&gt;【重点】&lt;/p&gt;

&lt;p&gt;能够理解 IP 地址的概念，熟记 IP 地址的格式组成和分类方法。&lt;/p&gt;

&lt;p&gt;【难点】&lt;/p&gt;

&lt;p&gt;能进行 IP 地址类型识别；学会查询自己的IP地址。&lt;/p&gt;

&lt;h4 id=&quot;三教学过程-4&quot;&gt;三、教学过程&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;环节一、导入新课&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;问：同学们，你们在生活中是否看见过一些违法的网站，这些网站都有什么内容呢？你来说一下，非法广告的网站、盗版的小说或者视频的网站。这样的一些网络违法行为，其实对我们生活是有一定的害处，那么我们中国最早的一起破获的网络犯罪是什么时候？那么它又是什么样的形式？我们警察又是如何破获的这样的一些案件呢？那么接下来从你们带着这个问题来看一看我们的视频&lt;/p&gt;

&lt;p&gt;1.老师利用多媒体播放视频，内容是关于我国首例利用因特网破获聚众赌博案件&lt;/p&gt;

&lt;p&gt;(1)学生观看视频&lt;/p&gt;

&lt;p&gt;(2)学生概括视频主要内容&lt;/p&gt;

&lt;p&gt;2.设置疑问：公安机关根据什么线索进行破案的?根据学生的回答，引入 IP 地址的概念。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;环节二、新知探究&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;任务一、答一答&lt;/p&gt;

&lt;p&gt;(1)学生自习课本上关于 IP 地址概念的内容&lt;/p&gt;

&lt;p&gt;(2)学生回答问题：“什么是 IP 地址”，老师做补充总结。&lt;/p&gt;

&lt;p&gt;任务二、查一查&lt;/p&gt;

&lt;p&gt;1.设置小竞赛，根据查看本机 IP 地址的方法，学生动手操作查看自己计算机的 IP 地址。&lt;/p&gt;

&lt;p&gt;2.请较快完成的同学说出自己的 IP 地址，老师在黑板上记录。&lt;/p&gt;

&lt;p&gt;任务三、说一说&lt;/p&gt;

&lt;p&gt;1.学生利用 2 分钟自习书上内容，讨论 IP 地址的组成特点。&lt;/p&gt;

&lt;p&gt;2.教师带领学生结合黑板上记录的 IP 地址，总结 IP 地址组成特点，包括点分十进制的表示方法及网络标识、主机标识；并通过对网络号和主机号的讨论，引入 IP 地址分类的概念。&lt;/p&gt;

&lt;p&gt;任务四、辨一辨&lt;/p&gt;

&lt;p&gt;1.学生们花 5 分钟时间自习书上内容，小组 IP 地址划分的依据和规律，小组代表进行回答，老师作总结补充。&lt;/p&gt;

&lt;p&gt;2.设置疑问：根据 IP 地址分类的特点，分析 IP 地址每个字节能表示的最大数值，同时总结 IP 地址对应的第一字节表示的数值的范围。&lt;/p&gt;

&lt;p&gt;3.设置疑问：根据黑板上记录的 IP 地址，判断其 IP 地址类型，通过学生的回答总结IP 地址判断分类的方法，并介绍记忆分类方式的便捷方式。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;环节三、巩固提高&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;根据之前学习的内容，完成巩固训练习题：&lt;/p&gt;

&lt;p&gt;1.请学生随机说出一个 IP 地址，设置纠错环节帮助学生进一步理解 IP 地址组成特点。&lt;/p&gt;

&lt;p&gt;2.进一步训练学生辨别 IP 地址类型的能力，突破难点。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;环节四、小结作业&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.简单回顾本节课所学要点。&lt;/p&gt;

&lt;p&gt;2.首尾呼应，回顾上课播放的视频，请同学们思考警察到底是如何根据 IP 地址查获罪犯，根据网络号和主机对此进行分析。&lt;/p&gt;

&lt;p&gt;3.通过上一个问题引出关于 IP 地址管理的问题，请同学们课后去查资料，下节上课时请同学们分享。&lt;/p&gt;

&lt;h4 id=&quot;四板书设计-4&quot;&gt;四、板书设计&lt;/h4&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;板书&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;b&gt;认识IP&lt;/b&gt;&lt;br /&gt;1.IP地址的概念&lt;br /&gt;2.IP地址的格式&lt;br /&gt;3.查询IP地址&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;ip地址的分类及其管理&quot;&gt;IP地址的分类及其管理&lt;/h3&gt;

&lt;h3 id=&quot;局域网和广域网&quot;&gt;局域网和广域网&lt;/h3&gt;

&lt;h4 id=&quot;一教学目标-5&quot;&gt;一、教学目标&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;知识与技能：了解局域网和广域网的概念&lt;/li&gt;
  &lt;li&gt;过程与方法：学会识别所在局域网&lt;/li&gt;
  &lt;li&gt;情感态度与价值观：使学生们通过对互联网的认识，提高对信息技术的兴趣。&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;二教学重难点-5&quot;&gt;二、教学重难点&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;教学重点：理解局域网和广域网的概念，并学会区分局域网和广域网&lt;/li&gt;
  &lt;li&gt;教学难点：&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;三教学过程-5&quot;&gt;三、教学过程&lt;/h4&gt;

&lt;h5 id=&quot;一导入-2&quot;&gt;(一)导入&lt;/h5&gt;

&lt;p&gt;导入：电话网络中，漫游费用比较贵，同一个地区相对便宜，使用短号不扣费。&lt;/p&gt;

&lt;p&gt;网络的分类标准有很多，按网络覆盖的地理范围大小，可以把计算机网络划分为局域网和广域网。&lt;/p&gt;

&lt;p&gt;一般来说，使用局域网传输数据速度比较快，而使用互联网则比较慢。&lt;/p&gt;

&lt;h5 id=&quot;二教授新课-3&quot;&gt;(二)教授新课&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;局域网&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;局域网，顾名思义，是覆盖局部地域的计算机网络（图 3.2.3），比如，计算机教室中的网络。组成局域网的计算机多则数百台，少的可能只有两三台，这些计算机一般可以同时访问网上的各种信息系统。现在，无线局域网已经在生活中普及，智能手机、平板计算机等设备大多具备了接入无线局域网的功能。局域网这个“大家庭”中的“新面孔”已经越来越多了。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;广域网&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;广域网一般用于把不同地区的网络连接起来，覆盖的地理范围比较大。例如，一个公司在各地的分支机构所组建的计算机网络可以看作局域网，而把这些分支机构的局域网连接起来，就形成了跨越多个地域的广域网。因特网可以看作覆盖范围最大的广域网。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;共享上网&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;随着信息技术的发展，需要接入互联网的设备越来越多，例如PC机、手机、监控器、电视机，以后或许冰箱空调都需要联网。王红希望家里的台式计算机、笔记本计算机、平板计算机、智能手机等能同时上网。这个时候应该怎么做呢？一位同学告诉她，可以利用路由器实现共享上网。&lt;/p&gt;

&lt;p&gt;实现共享上网的方法有很多，其原理大体相同：把访问请求发送给直接接入互联网的计算机或网络设备，由它们获取相应的信息后，反馈给请求者。&lt;/p&gt;

&lt;h5 id=&quot;三练习与讨论&quot;&gt;(三)练习与讨论&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;共享上网的设备会得到一个IP吗？将会得到一个局域网的IP&lt;/li&gt;
  &lt;li&gt;局域网的IP有哪些？&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;四小结-1&quot;&gt;(四)小结&lt;/h5&gt;

&lt;p&gt;根据本节课的内容，&lt;/p&gt;

&lt;h5 id=&quot;五作业-2&quot;&gt;(五)作业&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;回家后查看你的手机（或电视机、PC机获取到的局域网的IP）&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;四板书设计-5&quot;&gt;四、板书设计&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1.局域网
2.广域网
3.共享上网
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;dns域名系统&quot;&gt;DNS域名系统&lt;/h3&gt;

&lt;h4 id=&quot;一教学目标-6&quot;&gt;一、教学目标&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;知识与技能：了解使用域名上网的原理，了解域名组成和结构及关键域名的含义，学会查询域名对应的IP地址&lt;/li&gt;
  &lt;li&gt;过程与方法：讨论为什么要使用域名，识别域名类型，以及如何使用域名&lt;/li&gt;
  &lt;li&gt;情感态度与价值观：学生体验通过使用域名上网，体验的学习乐趣，在进行自主学习的过程中勇于克服困难，同时提高对网络技术应用的学习兴趣&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;二教学重难点-6&quot;&gt;二、教学重难点&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;教学重点：理解域名的概念，理解域名上网的原理&lt;/li&gt;
  &lt;li&gt;教学难点：能通过域名查询到对应的IP地址，识别域名的机构&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;三教学过程-6&quot;&gt;三、教学过程&lt;/h4&gt;

&lt;h5 id=&quot;一导入-3&quot;&gt;(一)导入&lt;/h5&gt;

&lt;p&gt;列举两个使用IP的网站和使用域名的网站，让同学们进行上网，并说出使用IP上网的问题。&lt;/p&gt;

&lt;p&gt;数字形式的 IP 地址，对人来说，还是难以记忆。因而，人们又采用了字符型的标识——域名。&lt;/p&gt;

&lt;p&gt;为什么要使用域名？（1）方便网站的IP地址更换而不需要告知他人；（2）方便记忆与访问；（3）识别机构；（4）智能DNS解析&lt;/p&gt;

&lt;h5 id=&quot;二教授新课-4&quot;&gt;(二)教授新课&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;域名的概念&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;由于IP地址具有不方便记忆并且不能显示地址组织的名称和性质等缺点，人们设计出了域名，并通过网域名称系统来将域名和IP地址相互映射，使人更方便地访问互联网，而不用去记住能够被机器直接读取的IP地址数串。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;域名的组成&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;一个完整的域名由2个或2个以上的部分组成，各部分之间用英文的句号“.”来分隔，最后一个“.”的右边部分称为顶级域名(TLD，也称为一级域名)，最后一个“.”的左边部分称为二级域名(SLD)，二级域名的左边部分称为三级域名，以此类推，每一级的域名控制它下一级域名的分配。&lt;/p&gt;

&lt;p&gt;例如，www.moe.gov.cn 就是一个域名，其中 cn 表示中国，gov 表示政府机构，moe 表示中华人民共和国教育部，www 是服务器的名称，合起来可以理解为“中国政府机构之一的中华人民共和国教育部的一台名为 www 的服务器”（图 3.2.17）。&lt;/p&gt;

&lt;p&gt;域名可以用来表示一个地域、一个单位或一个机构的网络系统，也可以用来表示网络中的某台计算机。例如，tsinghua.edu.cn是清华大学网络系统的名称，这个网络系统中可能包含多台计算机；www.tsinghua.edu.cn是清华大学网络系统中名为 www的计算机，拥有这个域名的计算机通常负责提供万维网服务。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;常见的顶级域名&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;国别域名：cn/en/us/ca/de&lt;/li&gt;
  &lt;li&gt;机构域名：com/net/org/top/name/site/gov/edu&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;域名中包含的很多字符串都有其特定的含义。比如，com表示商业机构，hk表示中国香港，mail表示邮件服务，blog表示网络博客服务，等等。&lt;/p&gt;

&lt;h5 id=&quot;三练习-1&quot;&gt;(三)练习&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;讨论：
    &lt;ul&gt;
      &lt;li&gt;（1）我们如何能够得到一个域名？（即域名由谁来管理，向域名注册商注册和解析即可使用）&lt;/li&gt;
      &lt;li&gt;（2）多个域名可以指向一个IP吗？&lt;/li&gt;
      &lt;li&gt;（3）一个域名可以指向多个IP吗？（引出负载均衡）&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;任务：
    &lt;ul&gt;
      &lt;li&gt;识别哪些是域名（把IP、email、URL、域名放到一起让同学们识别）&lt;/li&gt;
      &lt;li&gt;识别域名机构（edu.cn、gov.cn、gz.cn）&lt;/li&gt;
      &lt;li&gt;打开“命令提示符”窗口，执行 ping www.baidu.com 命令，查看显示的IP地址。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;2.启动浏览器，在地址框中分别输入上一步得到的IP地址和 www.baidu.com，观察浏览器窗口中显示的页面，看看是否访问了同一网站。（这一项目前不实用，大部分服务器都使用虚拟主机，一个IP上部署多个网站，使用域名来识别）&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;四小结-2&quot;&gt;(四)小结&lt;/h5&gt;

&lt;p&gt;根据本节课的内容，总结域名的几个要点。&lt;/p&gt;

&lt;h5 id=&quot;五作业-3&quot;&gt;(五)作业&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;查询以下域名映射的IP地址 www.gov.cn、www.moe.gov.cn、www.tsinghua.edu.cn&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;四板书设计-6&quot;&gt;四、板书设计&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;              DNS域名系统
1.域名的概念
2.域名的组成
3.域名机构及名称
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;组建无线局域网&quot;&gt;组建无线局域网&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;人教版高中信息技术必修二第三章第二课&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4 id=&quot;一教学目标-7&quot;&gt;一、教学目标&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;知识与技能：&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;通过学习，认识组建无线局域网的硬件设备及其功能，了解互联网的接入方式，知道信息系统的组成与功能。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;过程与方法：&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;通过组建小型无线局域网，体验无线路由器等常见设备的安装及设置方法，培养数字化学习与创新能力。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;情感态度与价值观：&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;通过学习，树立合理使用无线局域网的意识，能预判可能存在的安全风险，培养信息安全意识。&lt;/p&gt;

&lt;h4 id=&quot;二教学重难点-7&quot;&gt;二、教学重难点&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;教学重点：组建无线局域网的硬件设备及其功能。&lt;/li&gt;
  &lt;li&gt;教学难点：无线路由器等常见设备的安装及设置方法。&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;三教学过程-7&quot;&gt;三、教学过程&lt;/h4&gt;

&lt;h5 id=&quot;一导入-4&quot;&gt;(一)导入&lt;/h5&gt;

&lt;p&gt;生活实例导入：小明同学在家看NBA直播的时候，因为无线网信号时有时无，错过了很多精彩的瞬间，所以他决定重新换一台路由器，希望同学们帮助他更换路由器。从而引入本课《组建无线局域网》。&lt;/p&gt;

&lt;h5 id=&quot;二教授新课-5&quot;&gt;(二)教授新课&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;1.组建小型无线网络&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;(1)教师引导学生了解组建无线局域网的步骤。(连接设备、配置无线路由器、启用安全策略)&lt;/p&gt;

&lt;p&gt;(2)教师引导学生观看教学微课，组建无线局域网。(①将无线路由器的wan线连接外网网线。②将路由器的lan口通向网线连接笔记本电脑。③接通路由器电源)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.配置无线路由器&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;(1)教师引导学生小组讨论，合作探究如何配置无线路由器。(①观察路 由器参数，记录型号及路由器的IP地址，填写相应数据至实验报告中。②访问路由器。在浏览器的地址栏中输入无线路由器的IP地址，并设置登录密码，进行访问，做好记录。③设置路由器的网络参数，并记录。(打开“网络参数”、 观察“WAN口设置”、记录IP地址的获取方式、观察”LAN口设置”，记录IP地址子网掩码等信息)④设置无线网络。⑤若要再次修改路由器参数，必须重启路由器，恢复路由器出厂设置快捷操作：长按”reset’ 按钮5秒。&lt;/p&gt;

&lt;p&gt;(2)小组代表演示操作。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.使用客户端验证无线网络&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;教师引导学生尝试使用手机连接到自己设置的无线局域网中，通过访问网站验证是否连接是成功。&lt;/p&gt;

&lt;h5 id=&quot;三练习-2&quot;&gt;(三)练习&lt;/h5&gt;

&lt;p&gt;教师引导学生简述无线局域网的组建方法与步骤。&lt;/p&gt;

&lt;h5 id=&quot;三课堂小结&quot;&gt;(三)课堂小结&lt;/h5&gt;

&lt;p&gt;组织学生交流并分享本节课的收获，引导学生进一步明确无线局域网的组建方法以及配置路由器的注意事项。&lt;/p&gt;

&lt;h5 id=&quot;四作业&quot;&gt;(四)作业&lt;/h5&gt;

&lt;p&gt;下课之后，思考如何提高无线局域网的安全性，下节课继续分享。&lt;/p&gt;

&lt;h4 id=&quot;四板书设计-7&quot;&gt;四、板书设计&lt;/h4&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1.组建小型无线网络
2.配置无线路由器
3.使用客户端验证无线网络
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;数据库&quot;&gt;数据库&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;人工管理阶段：使用外存（磁带、卡片、纸带）、数据不易保存、没有专门的软件进行管理、数据不易共享、数据不具有独立性、数据无结构。&lt;/li&gt;
  &lt;li&gt;文件系统阶段：使用磁盘磁鼓等存储设备、有数据库管理软件。&lt;/li&gt;
  &lt;li&gt;数据库系统阶段：软件系统+数据库系统，广泛使用。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;常量变量及表达式&quot;&gt;常量、变量及表达式&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;人教版高中信息技术必修一第二章第三课&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4 id=&quot;一教学目标-8&quot;&gt;一、教学目标&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;知识与技能：&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;(1) 通过学习，掌握Python语言的基本知识，学会定义变量和常量，掌握变量与常量命名的约定原则。(2)通过学习，掌握利用运算符写出各种表达式以及表达式的运算求值。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;过程与方法：&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;通过案例教学、自助探究、讲解的方法，通过运算表达式的求值计算的过程，了 解人与计算机解决问题的异同。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;情感态度与价值观：&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;(1)通过掌握Python语言的基本知识，体验通过编程解决问题的基本方法，感受计算机编程的能力。&lt;/p&gt;

&lt;p&gt;(2)培养学生对算法和程序设计的兴趣，养成运用计算机分析问题、解决问题的习惯。&lt;/p&gt;

&lt;h4 id=&quot;二教学重难点-8&quot;&gt;二、教学重难点&lt;/h4&gt;

&lt;p&gt;教学重点：掌握Python的常用变量及变量名的命名规则，掌握表达式的书写及求值方法。&lt;/p&gt;

&lt;p&gt;教学难点：掌握表达式的运算规则及求值方法。&lt;/p&gt;

&lt;h4 id=&quot;三教学过程-8&quot;&gt;三、教学过程&lt;/h4&gt;

&lt;h5 id=&quot;一导入-5&quot;&gt;(一)导入&lt;/h5&gt;

&lt;p&gt;教师采用复习导入的方式进行，引导学生回顾Python语言常用的数据类型(Python语 言常用的数据类型有整型，浮点型，字符串型，布尔型，列表)，检查学生掌握情况，并引出本节课《常量、变量及表达式》。&lt;/p&gt;

&lt;h5 id=&quot;二教授新课-6&quot;&gt;(二)教授新课&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;1. 常量与变量&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;(1)教师引导学生阅读教材并思考：程序设计语言中常量与变量的意义(常 量是指在程序运行过程中保持不变的量；变量是指在程序执行过程中，其值可以改变的量称为变量)，&lt;/p&gt;

&lt;p&gt;(2)教师在多媒体上播放《变量名命名规则》教学微课。&lt;/p&gt;

&lt;p&gt;(3)学生总结视频中变量命名规则以及注意事项。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. 运算符&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;(1)教师引导学生思考有几种运算符。 (算术运算符，关系运算符，逻辑运算符)&lt;/p&gt;

&lt;p&gt;(2)教师在多媒体上展示Python语句中的算术和关系运算符，引导学生小组讨论哪些算术和关系运算符是数学课中没有学过的，哪些和数学课上的写法不一样?&lt;/p&gt;

&lt;p&gt;(3)学生以小组为单位进行讨论，了解Python语言中常见的逻辑运算符，并制作成表格。&lt;/p&gt;

&lt;p&gt;(4)教师请一位小组代表通过多媒体展示绘制的表格。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. 表达式运算规则&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;教师引导学生阅读课本，总结表达式的运算规则。&lt;/p&gt;

&lt;h5 id=&quot;三练习-3&quot;&gt;(三)练习&lt;/h5&gt;

&lt;p&gt;学生们利用本节课学习的知识完成Python语言表达式的书写。&lt;/p&gt;

&lt;h5 id=&quot;四小结-3&quot;&gt;(四)小结&lt;/h5&gt;

&lt;p&gt;组织学生交流并分享本节课的收获，引导学生进一步明确Python语言中变量与常量命名的约定原则以及表达式的运算规则。&lt;/p&gt;

&lt;h5 id=&quot;五作业-4&quot;&gt;(五)作业&lt;/h5&gt;

&lt;p&gt;下课之后预习Python的语句和程序结构，下节课继续学习。&lt;/p&gt;

&lt;h4 id=&quot;四板书设计-8&quot;&gt;四、板书设计&lt;/h4&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;板书&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;b&gt;常量、变量及表达式&lt;/b&gt;&lt;br /&gt;1.常量与变量&lt;br /&gt;2.运算符&lt;br /&gt;3.表达式运算规则&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h6 id=&quot;视频教学汇总&quot;&gt;视频教学汇总&lt;/h6&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.ixigua.com/6911556767336006147?logTag=kYyv-NpJytbCpeerZAsCs&quot;&gt;信息的基本特征&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>教资结构化</title>
   <link href="https://comeround.cn/article/jiaozi-jiegouhua.html"/>
   <updated>2020-12-19T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/jiaozi-jiegouhua</id>
   <content type="html">&lt;style type=&quot;text/css&quot;&gt;
p {
    text-indent: 1.5em;
    margin-bottom: 10px;
}
del{
    text-decoration: line-through;
    background-color: #fff;
}
&lt;/style&gt;

&lt;p&gt;管理能力：学生管理、班级管理、活动组织&lt;/p&gt;

&lt;p&gt;人际关系：沟通家长、协调同事、服从领导&lt;/p&gt;

&lt;p&gt;综合分析：职业认知、观点辨析、现象分析&lt;/p&gt;

&lt;p&gt;时事政治：国家大事、教育政策、领导讲话&lt;/p&gt;

&lt;h5 id=&quot;索引&quot;&gt;索引&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#通用版本语句&quot;&gt;通用版本语句&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#经典语句&quot;&gt;经典语句&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#万金油句子&quot;&gt;万金油句子&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#1组织活动类&quot;&gt;（1）组织活动类&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2应急应变类&quot;&gt;（2）应急应变类&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#3职业认知自我认知&quot;&gt;（3）职业认知&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#5沟通协调类&quot;&gt;（5）沟通协调类&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#6教育观点&quot;&gt;（6）教育观点&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#7综合分析&quot;&gt;（7）综合分析&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#8时事政治&quot;&gt;（8）时事政治&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h6 id=&quot;通用版本语句&quot;&gt;通用版本语句&lt;/h6&gt;

&lt;ul&gt;
  &lt;li&gt;加强学习。学习党的理论方针政策，学习教育教学的基本规律，学习本学科的专业知识，保持真诚、谦虚的态度，向领导、前辈、同事学习请教。向实践学习，向前辈学习。从书本里学习，从网络上学习，向优秀的老师们学习。&lt;/li&gt;
  &lt;li&gt;尊重领导，服从领导的安排，维护领导的权威，认真完成好领导交给的各项工作任务，团结同事，不计较个人的利益得失，从工作大局出发，做好自己的本职工作。&lt;/li&gt;
  &lt;li&gt;把学生放在心上，把学生当做亲人，想学生之所想，急学生之所急，竭尽全力帮助学生解决实际困难和问题。真正成为学生的支持者，引导者，帮助者，促进者。&lt;/li&gt;
  &lt;li&gt;在日常工作中，严格要求自己，加强组织纪律性，不断提升定力，修剪欲望，茁壮心灵，抵制诱惑，做到清净自守。我会耐得住寂寞，守得住清贫，抵得住诱惑，稳得住心神。&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
  &lt;li&gt;作为一名教师，我们要尊重、关爱每一位学生，不歧视任何一位学生。&lt;/li&gt;
  &lt;li&gt;作为一名教师，我们要恪守教师职业道德规范，真正做到爱国守法、爱岗敬业、关爱学生、教书育人、为人师表、终身学习。&lt;/li&gt;
  &lt;li&gt;作为一名教师，我们要加强与学生的沟通、交流、对话，与学生建立平等、友好、和谐的师生关系。动之以情，晓之以理，讲道理，摆事实，要用心打动学生。&lt;/li&gt;
  &lt;li&gt;作为一名教师，我们要关注每一名学生的不同特点和个性，了解学生的具体特点，发扬积极因素，克服消极因素，扬长避短，长善救失，做到因材施教。&lt;/li&gt;
  &lt;li&gt;学生是发展中的人，作为一名教师，我们应该用发展的眼光来看待每一位学生的发展。&lt;/li&gt;
  &lt;li&gt;作为一名教师，应加强与家长的沟通与交流，做好家校合作，形成教育合力，促进学生全面发展。&lt;/li&gt;
  &lt;li&gt;作为一名教师，在教学过程中，应该发挥教师的主导作用，尊重学生的主体地位，启发诱导学生，不断调动学生学习的积极性、主动性和创造性。&lt;/li&gt;
  &lt;li&gt;作为一名教师，应树立终身学习的理念，促进自身专业成长和发展。&lt;/li&gt;
  &lt;li&gt;作为一名教师，通过开展课外活动、集体活动和主题班会，让学生积极融入班集体，感受集体温暖。&lt;/li&gt;
  &lt;li&gt;作为一名教师，应不断进行教学反思，发现问题，分析问题，解决问题，不断提升自身全方位的素质和能力，促进自身全面发展。&lt;/li&gt;
&lt;/ol&gt;

&lt;h6 id=&quot;经典语句&quot;&gt;经典语句&lt;/h6&gt;

&lt;ul&gt;
  &lt;li&gt;作为老师一定要以保护学生的自尊心和隐私为前提，站在学生的角度，要考虑学生的情感需要。&lt;/li&gt;
  &lt;li&gt;我们要踏踏实实做好专业教学和班级管理工作，关注每一位学生的发展，定期组织情感教育的主题班会，进行熏陶。&lt;/li&gt;
  &lt;li&gt;在今后的工作中，我会尽自己最大的能力做到热爱学生、爱岗敬业，在工作岗位上发光发热，为国家教育事业增添一砖一瓦。&lt;/li&gt;
  &lt;li&gt;我们要在教学过程中应该发挥教师的主导作用，尊重学生的主体地位，启发诱导学生，不断调动学生学习的积极性主动性和创造性。要做到关爱学生，加强与学生的沟通与交流，对学生的品格和思想进行指导，做学生的良师益友。&lt;/li&gt;
  &lt;li&gt;作为教育工作者，要坚定教书育人的信念，把教书育人这一使命与追求真正地内化于心、外化于行，渗透于自己的一言一行，以文化人、以德育人，不断提高道德修养，加强自我教育。&lt;/li&gt;
&lt;/ul&gt;

&lt;h6 id=&quot;万金油句子&quot;&gt;万金油句子&lt;/h6&gt;

&lt;p&gt;对于应对结构化面试来讲，也不是没有秘诀，毕竟考官每天面对这么多考生，听的可不仅仅是你对于一个问题的态度，更重要的是你最后回答的内容是否跟教师职业理念和教师职业道德相关。我就给你们整理了以下“万金油”式的句子，供你们参考，还确定面试的姐妹可以先看看，找找感觉哈。&lt;/p&gt;

&lt;p&gt;【全面发展类】&lt;/p&gt;

&lt;p&gt;我们要转变传统的应试教育思想，改变课程评价中“以分数论英雄，以成绩定好坏”的思想，宣传素质教育理念，促进德智体美劳全面发展，不仅使学生学会知识，更要学会学习、学会生存、学会做人。&lt;/p&gt;

&lt;p&gt;【因材施教类】&lt;/p&gt;

&lt;p&gt;正所谓一把钥匙开一把锁，每个学生都有自身的特点和差异，我们要充分了解每一位学生兴趣爱好，做到有的放矢的教育，使每位学生都能扬长避短，得到适合自己个性的发展（人像树木一样，要使他们尽量长上去，不能勉强都长得一样高，应当是：立脚点上求平等，于出头处谋自由。）&lt;/p&gt;

&lt;p&gt;【关爱学生类】&lt;/p&gt;

&lt;p&gt;苏霍姆林斯基曾经说过：“如果你问我世界上什么东西最重要我会毫不犹豫的回答，那就是对于学生的爱。”（捧着一颗心来，不带半根草去）关爱学生，是师德的灵魂，没有爱，就没有教育。关爱学生要全面关心学生的成长，关心学生的生理和心理健康，并且把爱的种子洒向每一位学生，并且不会因为自己的情绪而改变，也不会因为学会学生变化而改变&lt;/p&gt;

&lt;p&gt;【尊重学生类】&lt;/p&gt;

&lt;p&gt;教育的艺术在于相信和尊重每一个学生，使他们的力量和可能性发挥出来，充分享受到成功的乐趣。尊重学生我们首先要做到尊重学生的人格，只有尊重学生的人格学生才会感到自信、自强不息，其次是尊重学生的个性。用宽容之心对待学生的每一次过失，用期待之心对待学生的每一点进步，用欣赏的目光关注学生的每一个闪光点，用喜悦的心情赞许学生的每一份成功。&lt;/p&gt;

&lt;p&gt;【公平对待每一位学生类】&lt;/p&gt;

&lt;p&gt;作为教师，不能以成绩好坏来评定学生，教师心里决不能有坏学生、差学生，而只有先进生和后进生，教师要以发展的眼光看待每一位学生。陶行知说过：“在教师手里操着幼年人的命运，便操着民族和人类的命运。”可见教师身上责任重大。每个学生的命运都与教师的教育息息相关。因此，教师更应公平地对待每一位学生。&lt;/p&gt;

&lt;p&gt;【教书育人类】&lt;/p&gt;

&lt;p&gt;韩愈曾经说过：“师者 所以传道受业解惑也。”教书育人是教师的天职，教书是传授知识和技能；而育人是指培养学生的人生观、世界观、价值观，教导学生今后如何做人、做事。教书育人二者又是因果关系，又是互动关系，又各自独立。教书比较容易做到，育人难以实现。要想真正的实现育人首先要做到关心尊重每一位学生，从学生的角度出发，实现教学和德育的双重进步。&lt;/p&gt;

&lt;h2 id=&quot;1组织活动类&quot;&gt;（1）组织活动类&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;活动的作用：感谢校长对我的信任，我会保质保量完成各项工作，不辜负校长对我的信任。&lt;/li&gt;
  &lt;li&gt;事前：我会了解掌握第一手资料和校长的具体指示安排，在此基础上制定某某活动的详细计划，计划包括时间、地点、人、财、物等，并报校长审批。&lt;/li&gt;
  &lt;li&gt;事中：我会按照事先制定好的计划开展某某活动，做好活动开展过程中的各项后勤服务保障工作，做好各种突发事件的应对，及时根据环境的变化，综合考虑各种因素，调整计划，保证该项活动顺利开展和进行。&lt;/li&gt;
  &lt;li&gt;事后：该项活动结束后，我会及时向校长做出详细汇报，有必要的话，形成书面材料，总结成败得失，以便以后更好的开展类似工作。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;1校长让你组织一次夏令营活动你打算怎么办&quot;&gt;1、校长让你组织一次夏令营活动，你打算怎么办？&lt;/h3&gt;

&lt;p&gt;夏令营活动有助于培养学生热爱生活的情感和团队合作的意识，是一项非常有意义的活动，校长把这项活动交给我来组织，是对我的极大信任，我一定尽全力把它组织好。(表态)&lt;/p&gt;

&lt;p&gt;首先，我会跟领导进行沟通，明确此次活动的主题，跟有相关经验的进行修改，确立方案。(事前)&lt;/p&gt;

&lt;p&gt;其次，在活动过程中，我会将责任落实到人，分别负责联系班车，接送学生到达活动现场；组织学生开展活动，发放活动材料；后勤负责人按时为学生提供水、食物等必需品，安排大家的住宿；校医跟随队伍，如果有学生发生中暑等突发情况就及时就地进行救治。我个人也会参与其中，保证整个夏令营活动有序有效地开展。(事中)&lt;/p&gt;

&lt;p&gt;最后，活动结束后，我会总结经验，对不足之处进行反思，为今后更好地开展类似工作积累经验。(事后)&lt;/p&gt;

&lt;h3 id=&quot;2你会如何组织家长会&quot;&gt;2、你会如何组织家长会？&lt;/h3&gt;

&lt;p&gt;家长会是班主任与家长沟通的重要桥梁。作为新生班主任，第一-次家长会的成功与否直接决定着今后工作的开展，所以其重要性不言而喻。&lt;/p&gt;

&lt;p&gt;(事前)在召开家长会之前我会做好充足的准备，将家长会的时间订在周末或者放学后的晚上，方便家长参加。发放家长会邀请函，通过纸质回访或电访方式告知家长会的时间、地点，确定到会家长人数。另外准备好家长会上要讲的内容，做到有备无患。&lt;/p&gt;

&lt;p&gt;(事中)在家长会当天，安排班长对参会的家长进行签到。家长会开始，根据先前制定的计划和流程，灵活的进行会议：向新生家长自我介绍、介绍学校及班级的规定和要求，邀请新生发言，向家长汇报本学期的计划安排。同时把家长会上家长提出的问题记录下来，在会后与家长进行沟通与解决。在会议结束后，将会议内容告知未能到场的其他家长。&lt;/p&gt;

&lt;p&gt;(事后)家长会结束后，送走家长，向学生们有选择的通报家长会的内容。并适时做好家长会的总结，将材料组织备案，以便以后更好地组织家长会。同时做好家长的回访，以及家长会遗留的问题继续跟进，并做好总结报告，作为以后的经验借鉴。&lt;/p&gt;

&lt;h3 id=&quot;3作为班主任你会如何团结班级任课教师共建良好班风&quot;&gt;3、作为班主任，你会如何团结班级任课教师共建良好班风？&lt;/h3&gt;

&lt;p&gt;其次，班里的班风、学风建设要鼓励任课教师多谈谈自己的看法，共同参与班级管理工作，对班里出现的问题要及时征求任课教师的看法。&lt;/p&gt;

&lt;p&gt;再次，在班里要树立任课教师的威信，避免学生忽视任课教师尤其是那些副科教师。&lt;/p&gt;

&lt;p&gt;最后，从个体的角度来讲，我也会在工作之余多与各任课教师进行沟通和交流，建立良好的同事关系。&lt;/p&gt;

&lt;h2 id=&quot;2应急应变类&quot;&gt;（2）应急应变类&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;步骤
    &lt;ul&gt;
      &lt;li&gt;控制状况，避免恶化&lt;/li&gt;
      &lt;li&gt;轻重缓急&lt;/li&gt;
      &lt;li&gt;采取措施&lt;/li&gt;
      &lt;li&gt;事后反思、避免再次发生&lt;/li&gt;
      &lt;li&gt;应急应变类题目主要考查教师的临场应变与随机处理能力，要求教师反应敏捷、处置科学妥当。&lt;/li&gt;
      &lt;li&gt;所谓应急应变，即在有压力的情境下，能够情绪稳定，迅速而灵活地转换角度，做出正确的判断，快速思考并解决问题。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;我会保持冷静，不慌张，控制好自己的情绪，积极应对，妥善处理，具体问题具体分析，具体情况具体对待。&lt;/li&gt;
  &lt;li&gt;深入学生，深入实际，了解掌握真实情况，一切从实际出发，实事求是，解决问题。&lt;/li&gt;
  &lt;li&gt;课后我会进行自我反思，透过现象看本质，发现问题，分析原因，总结经验，弥补不足，解决问题，同时，加强学习，不断提升自己，让自己成为一名优秀的人民教师，更好的服务于学生的全面发展。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;1在一次户外活动中有个同学突然中暑你怎么处理&quot;&gt;1、在一次户外活动中，有个同学突然中暑，你怎么处理？&lt;/h3&gt;

&lt;p&gt;遇到这种突发事件，我会保持清醒的头脑，学生的安全是第一位的。我会从以下几个方面来着手处理：&lt;/p&gt;

&lt;p&gt;首先，我会让班干部暂时代替我来负责组织大家的活动，避免因为学生的围观造成秩序混乱，影响对中暑同学的治疗，也避免混乱中导致其他恶性事件的发生。(控制)&lt;/p&gt;

&lt;p&gt;其次，我会找几个身强体壮的学生帮我一起把中暑的学生抬到阴凉处，如果只是轻度中暑的话，我会用湿毛巾进行物理降温，并帮助学生补水；如果情况比较严重，我会马上电话联系学校医务室和120急救，尽快将学生送往医院进行治疗。(措施)&lt;/p&gt;

&lt;p&gt;最后，针对此事，我会深刻反省，分析出现该现象的原因，避免再次发生。(反省)&lt;/p&gt;

&lt;h3 id=&quot;2你在上课时如果有学生发现你的板书错误怎么办&quot;&gt;2、你在上课时，如果有学生发现你的板书错误怎么办？&lt;/h3&gt;

&lt;p&gt;1.表明观点&lt;/p&gt;

&lt;p&gt;如果有学生当面指出了我板书上的错误，我不会生气，更不会责怪这位同学，而是会抓住这个给学生树立表率的难得的机会，勇于承认错误，及时改正板书的错误之处，并再次讲解一下板书上的错误，以免影响学生对板书内容的理解。&lt;/p&gt;

&lt;p&gt;2.处理措施&lt;/p&gt;

&lt;p&gt;首先，我会在全班同学面前表扬这名同学，他能够及时指出我的错误，避免其他同学受到错误信息的误导，这是很勇敢也是很有责任感的行为，并号召同学们向他学习。这样既保护了同学们上课的积极性，也保证教学能继续进行。&lt;/p&gt;

&lt;p&gt;其次，我会立即对板书错的内容进行思考，快速将正确的板书内容展示给同学们，询问大家是否理解，是否还有其他的疑问等，保证这次内容讲解的正确性。&lt;/p&gt;

&lt;p&gt;再次，改正之后再次向同学们承认错误，检讨问题所在。我会向同学们保证今后一定严格要求自己，避免再犯这样的问题，也希望同学们以后继续指出我的问题。&lt;/p&gt;

&lt;p&gt;(事后反思，避免发生)最后，在课后我会审视自己在教学中的不足，尤其要注重教学过程的严谨性。我也会不断升高自身的专业素养，升高敬业精神，并和学生保持积极互动，实现教学相长。&lt;/p&gt;

&lt;h3 id=&quot;3上课时你正在专心的写板书突然有两位同学打起来了你会怎么办&quot;&gt;3、上课时，你正在专心的写板书，突然有两位同学打起来了，你会怎么办？&lt;/h3&gt;

&lt;p&gt;&lt;del&gt;考生思考完毕，针对您刚刚所说的这个问题。在上课的过程中，我正在写板书，突然间有两个同学打起来了。&lt;/del&gt;在面对这个问题时，我会采取如下的解决方式。&lt;/p&gt;

&lt;p&gt;首先，我会保持冷静，停止板书，并且让班级里个子比较高的同学让他们分开，然后让他们分开坐，这样做的目的也是能够让他们两位冷静下来，然后我会召集全班同学再次将注意力集中到课堂上。保证这堂课的有序进行。&lt;/p&gt;

&lt;p&gt;在课程结束后，我会将两位男同学从教室带到办公室，去询问他们打架的真实原因。但是不管原因是什么，我都要&lt;del&gt;严厉的&lt;/del&gt;&lt;ins&gt;适当的&lt;/ins&gt;批评他们。并且让他们明白在课堂上打架是不正确的，这样做严重的扰乱了课堂秩序。当然，针对他们打架的真实原因，我会给出针对性的解决方案，如果说他们打架是因为在一道题上争执不休，那作为老师，我会带领他们寻找问题的真实答案，并告诉他们，以后在学习中如果遇到类似的问题，可以在课后找老师解决；如果说他是打架，是因为彼此在此之前就看不顺眼，我会认真的听他们的说法，并帮助他们消除误会。&lt;/p&gt;

&lt;p&gt;最后，我会在班会中召集一次主题班会，请全体同学来谈一谈对于团结友爱的看法，并请全班同学明白，遇到问题要戒骄戒躁，寻求正确的解决方式，打架解决不了任何问题。&lt;/p&gt;

&lt;p&gt;总之，作为一位老师，遇到类似的情况，要努力将影响降到最低，追求更好的方式帮助学生解决问题。&lt;del&gt;好的，考官，&lt;/del&gt;以上是我对遇到这种情况的做法。&lt;/p&gt;

&lt;h3 id=&quot;4你发现自己的课越来越不受学生欢迎还有学生逃课你该怎么办&quot;&gt;4、你发现自己的课越来越不受学生欢迎，还有学生逃课，你该怎么办？&lt;/h3&gt;

&lt;p&gt;谢谢考官，考生现在开始答题。如果出现这样的情况，首先我会对这件事情引起重视，作出解决方案。&lt;/p&gt;

&lt;p&gt;首先，&lt;/p&gt;

&lt;h2 id=&quot;3职业认知自我认知&quot;&gt;（3）职业认知[自我认知]&lt;/h2&gt;

&lt;h3 id=&quot;1你为什么想要当一名教师你觉得你适合当一名教师吗&quot;&gt;1、你为什么想要当一名教师？/你觉得你适合当一名教师吗？&lt;/h3&gt;

&lt;p&gt;都说“教师是太阳底下最光辉的职业”，我非常热爱这个充满奉献精神、充满挑战的职业，我选择成为一名教师的原因有以下几点：&lt;/p&gt;

&lt;p&gt;首先，教师这一职业符合我的人生规划，早在年少时我就立志要做一名老师，所以在读大学时我义无反顾地选择了师范院校。（职业规划）&lt;/p&gt;

&lt;p&gt;其次，我的知识储备符合做一名老师的要求，在四年的大学生涯中我积累了很多教育理论知识和学科专业知识，这些都为我成为一名教师打下了坚实的理论基础（理论）；在大学期间我参加过多次支教活动，与那里的孩子们进行过深入交流，这些经历让我看到了孩子们对知识的渴望，也让我深深地体会到了作为一名教师的真正价值，我也在此过程中积累了一定的教学经验、学会了很多与孩子们相处的方法和技巧。（实践经验）&lt;/p&gt;

&lt;p&gt;再次，我的性格也很适合做老师，我很喜欢和孩子们相处，做事有耐心、有毅力，这些也都符合教师的职业特点。&lt;/p&gt;

&lt;p&gt;通过对自我的深度剖析，我认为我是适合做老师的。但是我身上也有一些不足，我会在今后的工作中向老教师请教，争取从新手型教师向成熟型教师转变。（表态）所以我来参加此次招考，希望能够有幸走上讲台，谢谢各位评委老师给我这次实现梦想的机会。&lt;/p&gt;

&lt;h3 id=&quot;2你的优点与不足是什么&quot;&gt;2、你的优点与不足是什么？&lt;/h3&gt;

&lt;p&gt;各位评委老师，下面开始我的作答。首先我来说说我的优点。首先，我做事情目标非常明确。&lt;/p&gt;

&lt;p&gt;（优点1）我出生在一个教师之家，爷爷和爸爸、妈妈都是教师，耳濡目染，所以我在很小的时候就立志要成为一名老师，在报考大学的时候我义无反顾地选择了师范院校。其次，我的知识储备与实践经验较为丰富。（优点2）在校期间，我努力地学习各门专业课程和教育理论知识，并且积极参加学校组织的说课大赛、课件大赛等，不断地提升自身素养。在临近毕业的时候，我在市内的一所XXX实习了近三个月，期间收获颇丰，我开始学着将我的理论知识付诸实践，并在实践过程中不断地摸索经验。此外，我的性格活泼开朗，我很喜欢和孩子们相处，做事有耐心、有毅力，(优点3）&lt;/p&gt;

&lt;p&gt;我的不足是虽然我参加过三个月的教育实习，并获得了优异的成绩，但是不是毕竟一直站在教学的第一线，所以经验上还是有很多欠缺的。（缺点1）我会在今后的工作中积极向老教师请教，弥补自己的不足，争取从新手型教师迅速向成熟型教师转变。&lt;/p&gt;

&lt;p&gt;（表态）最后，希望能够有幸走上讲台，谢谢各位评委老师给我这次实现梦想的机会。&lt;/p&gt;

&lt;h3 id=&quot;3你最喜欢的教育家是谁&quot;&gt;3、你最喜欢的教育家是谁？&lt;/h3&gt;

&lt;p&gt;我最崇拜的教育家是素有英语教育界泰斗之称的——张道真。（陈述）&lt;/p&gt;

&lt;p&gt;我之所以崇拜他，原因有三：第一，高尚的人格魅力。76岁高龄的张道真教授，在国内外英语教育界享有盛誉。他把毕生的经历都献身于教育并研究教育，正是他带领着我们走着英语教育改革的每一个步伐!第二，科学、实用的英语教学方法。他提出了一系列的方法来改变这种状态。而这些行之有效的方法被广泛应用到实际教学中。第三，严谨治学的思想前瞻性。张教授提倡考试要改革，听说与读写，二者并举， 甚至听说占有更重要的地位。（描述理由）&lt;/p&gt;

&lt;p&gt;思想深邃的张道真教授，以其独特的人格魅力，科学的工作态度，严谨的治学思想，深深地影响了我，（启示）我要秉承先生的思想和态度，在未来的英语教学之路上，扎根一线，默默奋斗，勇敢向前！（表态）&lt;/p&gt;

&lt;h3 id=&quot;4我最喜欢的书籍&quot;&gt;4、我最喜欢的书籍？&lt;/h3&gt;

&lt;p&gt;我最喜欢的教育著作是《夏山学校》这本书。（陈述）《夏山学校》这本书是由夏山学校的创办者尼尔写的，主要对夏山学校的办学理念进行了介绍。夏山学校秉承人本主义办学理念，对每一个学生都平等对待，学校的学生通过宽松的教学氛围，感受到与正规学校不一样的学习体验。（描述）通过阅读《夏山学校》，我觉得自己在以下方面有所收获：（启示）&lt;/p&gt;

&lt;p&gt;首先，他让我认识到对于学生要积极看待，尊重学生人格。在夏山学校，学生和老师有着平等的地位，他们在遇到问题时，通过召开学校大会平等进行协商，每个人在这个过程中，都感觉到自己的人格受到尊重；&lt;/p&gt;

&lt;p&gt;其次，我认识到，对于学生的错误要包容。在夏山学校，每一个学生犯错误，都不会受到别人的批评，他受到更多的是别人的宽容与帮助，在这样的环境中，反而学生会获得更大的成长。&lt;/p&gt;

&lt;p&gt;第三，这本书还让我认识到，在课堂中，应注意情境创设，引起学生的学习兴趣。在夏山学校，学生在学习时，兴趣是非常重要的，每个人根据自己的兴趣选择课程。虽然在我们的教育中无法实现这一点，但我可以通过创设课堂情境，激发学生的学习兴趣。&lt;/p&gt;

&lt;p&gt;总之，如果我有幸成为一名光荣的人民教师，我会积极地把上面的收获用在教学工作中，争取对自己的教学有所帮助。（表态）&lt;/p&gt;

&lt;h3 id=&quot;5有2个名额的优秀教师评选你会怎么做&quot;&gt;5、有2个名额的优秀教师评选，你会怎么做？&lt;/h3&gt;

&lt;p&gt;【思路点拨】
此题属于考察教师职业积极性的问题，面对优秀教师的评选，看考生是否能够积极争取，以及如何面对竞争中的压力和可能的失败，因此是一道典型的自我认知类的题目。对于此题可从：说明意义——阐释态度——自我梳理——总结提升，思路进行回答。&lt;/p&gt;

&lt;p&gt;【参考答案】&lt;/p&gt;

&lt;p&gt;（说明意义）开展优秀教师评选能够加强教师队伍建设， 提高广大教职工的工作积极性；对于个人，也有利于精进专业水平、增加工作热忱。&lt;/p&gt;

&lt;p&gt;（阐释态度）遇到有 2 个名额的优秀教师评选，虽然名额有限，但这也是对自己能力的一次审核。我会本着积极的态度参加评选，客观全面的展现自己平日里的工作成绩。&lt;/p&gt;

&lt;p&gt;（自我梳理）在评选过程中，我会展示自己的专业素质和教学水平。在工作中，我一直秉承着对学生耐心和教学认真的态度、努力提升自己的教学水平，在过去的教师生涯中，我一直爱岗敬业，勤勤恳恳，上课前备学生备教材，课堂中采用新课改倡导下的新型教学观，课后及时自我总结。平时积极向老教师请教，交流经验，和学生以及同事之间建立了融洽的关系。所以，我相信自己有实力参加优秀教师的评选。&lt;/p&gt;

&lt;p&gt;（总结提升）美国教育家波斯纳曾提出过“教师的成长＝经验＋反思”，通过这次评选，我会对过去的自己及时多方面的总结和提升。荣誉只能说明过去，不论有没有评选上，我都会继续高标准来要求自己，始终以学习者的心态在专业上丰富知识储备，多向模范教师学习，提升教研水平，爱工作爱学生，做一位有爱心，耐心和责任心的好老师。&lt;/p&gt;

&lt;h3 id=&quot;6教师要耐得住寂寞清贫教师要守住这片净土你为什么选择教师这个行业&quot;&gt;6、教师要耐得住寂寞、清贫、教师要守住这片净土，你为什么选择教师这个行业？&lt;/h3&gt;

&lt;p&gt;【参考答案】
首先，我十分热爱教师这个写满奉献、充满挑战的行业，这里有可爱的孩子，令人敬佩的同事，他们是人生路上不可磨灭的一笔。教师是太阳底下最光辉的职业，是人类灵魂的工程师。尽管在物质上是贫乏的，但是在精神上却是富裕的。&lt;/p&gt;

&lt;p&gt;其次，我在大学期间系统的学习了教育理论知识和所报考职业的专业知识，具有一定的教育教学基础。&lt;/p&gt;

&lt;p&gt;第三，我在大学期间做过家教，暑假做过教师兼职，因此具有一定的教学实践基础。&lt;/p&gt;

&lt;p&gt;第四，在今后的工作中，我会尽自己最大的能力做到热爱学生、爱岗敬业，在工作岗位上发光发热，为国家教育事业增添一砖一瓦。&lt;/p&gt;

&lt;h3 id=&quot;7你为什么想从事教师这个职业待整理&quot;&gt;7、你为什么想从事教师这个职业？（待整理）&lt;/h3&gt;

&lt;p&gt;（1）家人的影响。我爷爷和爸爸都是教师，他们受人尊敬，从小到大给我很大的影响，我从小埋下了一颗种子。&lt;/p&gt;

&lt;p&gt;（2）我有专业背景。我学的是教师教育类专业，专业对口。&lt;/p&gt;

&lt;p&gt;（3）我性格耐心、细致、活泼、开朗，适合从事教师这一职业。&lt;/p&gt;

&lt;p&gt;（4）成为一名人民教师也是我的职业理想，我一直在积极努力。&lt;/p&gt;

&lt;p&gt;（5）教师这一职业社会地位高、工作条件好，工资福利也不错。&lt;/p&gt;

&lt;h3 id=&quot;8请结合教师工作岗位谈谈你有哪些优势和不足&quot;&gt;8、请结合教师工作岗位，谈谈你有哪些优势和不足。&lt;/h3&gt;

&lt;p&gt;我有以下几点优势：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;我有一定的专业背景和教育教学知识积累。我学的是教师教育类专业，专业对口。&lt;/li&gt;
  &lt;li&gt;我性格耐心、细致、活泼、开朗，适合从事教师这一职业。&lt;/li&gt;
  &lt;li&gt;成为一名人民教师也是我的职业理想，我一直在积极努力。&lt;/li&gt;
  &lt;li&gt;我有一定的综合分析能力、计划组织协调能力、人际关系处理能力、应变和情绪控制能力。
提到劣势，我认为我现在还很年轻，虽然有一定的理论知识积累，但是教育教学实践经验还不丰富，我相信，在各位领导、各位前辈、各位同事的关系支持帮助下，我会很快的成长起来的。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;7你认为一个优秀的教师是怎么样的&quot;&gt;7、你认为一个优秀的教师是怎么样的？&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;心态：心态保持年轻与天真烂漫、朝气蓬勃、活泼可爱的孩子在一起，当老师的自然而然地就会被感染，被熏陶。什么烦恼、什么忧愁、什么名利均荡然无存，均被洗涤干净。孩子们就是阳光，能刺透心里的雾霾，让人永远感到心理阳光。&lt;/li&gt;
  &lt;li&gt;远离世俗，减少是非老师的天职就是教书育人，与社会似乎离得较远，与纷杂人员接触较少，因而，少了许多的酒场和大鱼大肉的肥腻，知道的事情少，掺合的事情必然也少，因而也就避免了闲言碎语和是是非非，活得清静，活得坦然。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;5沟通协调类&quot;&gt;（5）沟通协调类&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;主要步骤
    &lt;ul&gt;
      &lt;li&gt;保持冷静，避免矛盾激化&lt;/li&gt;
      &lt;li&gt;进行反思，分析原因&lt;/li&gt;
      &lt;li&gt;有效沟通，解决问题&lt;/li&gt;
      &lt;li&gt;自我反省，避免再次发生&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;与领导处理人际关系
    &lt;ol&gt;
      &lt;li&gt;尊重领导，服从领导，维护领导的权威。&lt;/li&gt;
      &lt;li&gt;认真完成好领导交予的各项工作。&lt;/li&gt;
      &lt;li&gt;保持真诚、谦虚的态度向领导学习请教。&lt;/li&gt;
      &lt;li&gt;正确对待领导的批评，包容、宽容领导。&lt;/li&gt;
      &lt;li&gt;有问题有情况及时向领导请示汇报。&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;与同事处理人际关系
    &lt;ol&gt;
      &lt;li&gt;尊重同事，热情对待同事。&lt;/li&gt;
      &lt;li&gt;团结同事，不计较个人的利益得失，从工作大局出发，做好本职工作。&lt;/li&gt;
      &lt;li&gt;保持真诚、谦虚的态度向同事学习请教。&lt;/li&gt;
      &lt;li&gt;在日常工作中，与同事同担苦，共患难。&lt;/li&gt;
      &lt;li&gt;出现问题的时候，要先进行自我反思，选择恰当的时间、合适的场合，以一种合适的方式，与同事沟通交流，解决问题。&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;与学生关系处理
    &lt;ol&gt;
      &lt;li&gt;尊重、关爱、理解、宽容学生。&lt;/li&gt;
      &lt;li&gt;公平公正的对待每一位学生，不歧视任何一位学生。&lt;/li&gt;
      &lt;li&gt;加强与学生的沟通与交流，动之以情，晓之以理，讲道理，摆事实。&lt;/li&gt;
      &lt;li&gt;用发展的眼光看待每一位学生的发展，学生是发展中的人。&lt;/li&gt;
      &lt;li&gt;不断去了解每一位学生的不同的特点和个性，发扬其积极因素，克服其消极因素，扬长避短，长善救失，因材施教。&lt;/li&gt;
      &lt;li&gt;时刻把学生放在心上，帮助学生解决实际困难和问题。&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;与家长关系处理
    &lt;ol&gt;
      &lt;li&gt;尊重、理解、宽容家长，换位思考。&lt;/li&gt;
      &lt;li&gt;公平公正的对待每一位学生家长。&lt;/li&gt;
      &lt;li&gt;加强与学生家长的沟通与交流，动之以情，晓之以理，讲道理，摆事实。&lt;/li&gt;
      &lt;li&gt;密切与家长的合作（家校合作），形成教育合力。&lt;/li&gt;
      &lt;li&gt;帮助学生家长解决实际困难和问题。&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;与家人关系处理
    &lt;ol&gt;
      &lt;li&gt;尊重、理解、宽容家人。&lt;/li&gt;
      &lt;li&gt;遇到难题寻求家人的帮助和支持。&lt;/li&gt;
      &lt;li&gt;加强与家人的沟通与交流，动之以情，晓之以理，讲道理，摆事实。&lt;/li&gt;
      &lt;li&gt;在原则问题上，坚持立场和原则，不犯错误。&lt;/li&gt;
      &lt;li&gt;在坚持原则前提下，帮助家人解决实际困难和问题。&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;1家长到学校找到校长投诉你你怎么办&quot;&gt;1、家长到学校找到校长投诉你，你怎么办？&lt;/h3&gt;

&lt;p&gt;首先，发生这样的事情，我要保持冷静，不能因此影响了教学工作的正常开展。&lt;/p&gt;

&lt;p&gt;其次，既然有家长投诉，一定是我的工作出现了问题，我会积极分析原因：可能是教学上的问题、管理工作上的问题或者是沟通上不够及时。&lt;/p&gt;

&lt;p&gt;再次，我会主动去和家长进行沟通，承认自己工作上的失误，并向家长询问是哪里出现了失误，如果确实是我的原因，我会承认错误并致歉。如果不是我的原因，我也会耐心地解释说明情况，请求理解。另外我也会主动找校长道歉，并说明真实情况，保证不再发生类似的事情。(解决问题)。&lt;/p&gt;

&lt;p&gt;事后，我会深刻地反省自己，一方面踏踏实实做好专业教学和班级管理工作，另一方面及时和领导、学生家长进行沟通，保持信息的及时更新。(反思)&lt;/p&gt;

&lt;h3 id=&quot;2你想去学校进修校长不同意你会怎么做&quot;&gt;2、你想去学校进修，校长不同意，你会怎么做？&lt;/h3&gt;

&lt;p&gt;进修是提升自己专业水平的重要的学习机会，要争取进修的机会。&lt;/p&gt;

&lt;p&gt;首先，我会保持冷静，避免和校长发生口角冲突。其次，我会与领导沟通了解他不同意的原因：从工作方面来看，可能是学校的教学任务较重，校长担心教师去进修会耽误教学工作；还有可能是进修名额不够，校长已安排他人参加；从主观因素考虑，我会反思是不是自己教学经验不足，专业理论知识不够扎实，时机和条件不成熟，还需要锻炼。&lt;/p&gt;

&lt;p&gt;针对以上原因，那么我会与其他同事协调相关教学任务的分配，从而得到一定的空余时间去进修而不致影响正常的工作，并将协调的结果和去进修的意愿告诉校长。如果校长已安排其他有需要的人员参加，那说明我未达到培训的要求，&lt;/p&gt;

&lt;p&gt;我会加强自身学习，提高能力，争取早日达到相关要求，下次参加进修。进修是对工作的肯定，也是提高素质的途径。如果是主观因素，那么以后我会好好努力，待到时机成熟再与校长进行沟通。相信通过不懈努力，校长最终会同意我去进修。&lt;/p&gt;

&lt;h3 id=&quot;3小明尽管很努力但是他的成绩还是不好为此小明的家长总是打骂他作为班主任你应该怎么做&quot;&gt;3、小明尽管很努力，但是他的成绩还是不好，为此小明的家长总是打骂他，作为班主任你应该怎么做？&lt;/h3&gt;

&lt;p&gt;考生思考完毕，开始作答。作为小明的班主任，我有责任、有义务去帮助小明解决困难，我将采取一下措施。&lt;/p&gt;

&lt;p&gt;第一，针对于小明家长总是打骂他，那么我会和小明的家长进行沟通交流，告诉他一味的打骂只会影响孩子的成长，不利于孩子身心健康的发展，我们要正确的看待孩子，多去鼓励、多去肯定，毕竟孩子是发展中的人。相信通过我的劝说家长会理解我的这份赤诚之心。&lt;/p&gt;

&lt;p&gt;第二，我会找到小明进行沟通，了解情况，询问他最近的学习和生活方面有什么状况、有什么问题，以及什么难题，做好相应的记录工作。&lt;/p&gt;

&lt;p&gt;第三，针对我了解过来的情况，我会进行针对性的解决，如果是因为小明的学习方式方法不对，那么我会告诉他一些比较高效的学习方法，并且告诉他积极的和同班同学进行沟通交流。分享一些学习经验和想法，从而不断的提升自己；那如果是因为小明学习效率不高，那么我会告诉他进行合理的安排自己的作息时间，注重劳逸结合，方能提高自己的效率。&lt;/p&gt;

&lt;p&gt;那最后在我的日常工作当中，我会密切家校合作，形成教育合力，同时我也会加强与学生沟通和交流，及时的去了解孩子的情况以及在校表现，从而促进孩子的全面发展，考生回答完毕。&lt;/p&gt;

&lt;h3 id=&quot;4学生家长在微信群里要求更换数学老师作为班主任你怎么办2021&quot;&gt;4、学生家长在微信群里要求更换数学老师。作为班主任，你怎么办？(2021)&lt;/h3&gt;

&lt;p&gt;良好的家校关系有利于孩子的成长和教育，当微信群里出现这种情况时，我会快速反应，稳定住家长的情绪，避免事态扩大化，然后再妥善处理。&lt;/p&gt;

&lt;p&gt;首先，我会立刻做出回应，稳定家长情绪。我会马上在群里发言，告诉家长我已经收到他们的反馈，表明学校非常重视家长的意见，和谐的家校合作关系是促进孩子身心健康发展的保障，建议家长有意见可以直接跟我反映，打电话或者发微信都可以，还可以在接送孩子上学时与我沟通，我一定会尽力解决。同时，我会告诉家长，所有的科任老师，包括数学老师出发点都是为孩子好，如果有哪些地方做得不到位，请家长多包涵。&lt;/p&gt;

&lt;p&gt;其次，我会从多方了解情况。我会与家委会进行联系，向他们了解相关原因；与提出此想法的家长当面或者打电话等方式进行沟通，了解原因；并与数学老师沟通，把与家长了解到的情况反馈给他，听听数学老师的想法，并且安慰他的情绪，请他相信我和学校领导会给他一个公正、合理的处理结果。&lt;/p&gt;

&lt;p&gt;最后，我会针对性进行解决。如果双方只是因为缺少沟通造成了一些误会，那么我会做好双方的协调工作，解除误会；如果数学老师确实在教学理念和行为上有违反师德和法律等的行为，那么我将会汇报上级领导，请领导来解决，处理完毕后，我会在家长群里公示事情处理结果。&lt;/p&gt;

&lt;h2 id=&quot;6教育观点&quot;&gt;（6）教育观点&lt;/h2&gt;

&lt;h3 id=&quot;1你如何理解教学有法但无定法贵在得法&quot;&gt;1、你如何理解“教学有法，但无定法，贵在得法”？&lt;/h3&gt;

&lt;p&gt;所谓“教学有法”，是指教学有规律可循，学习一定的内容，面对一定的学生，为了实现一定的教学目标，都有与之相适应的教学模式、教学路径和教学步骤；所谓“教无定法”是指在具体的教学中并不存在“放之四海而皆准”的固定不变的方法，一切都因人、因情而定；所谓“贵在得法”，就是说教学方法要运用得恰到好处。（解释）&lt;/p&gt;

&lt;p&gt;首先，众所周知，教学方法是为了达到教学目的所采取的手段。我们运用这些方法以达到教学的目的。即使学科不同，教学方法也具有普遍性，如讲授法、谈话法、演示法等等，这可以说是教学有法。正因为教学有法，所以教学时不但要钻研教材，还要注意教法，既要学习有关教学法的论著，还要通过实践、探索，掌握其规律。&lt;/p&gt;

&lt;p&gt;其次，教学要从实际出发，要因人、因时而异，要因材施教，不能拘泥于某种教法，墨守成规，所以又要教无定法。我们应根据情况的不同而灵活运用，诸如对不同教学对象、不同的教学要求、同一课题内容都应有不同的教法。&lt;/p&gt;

&lt;p&gt;最后，教学方法因人而异，没有一种教学方法是适合所有人的，但要适合个人，这就是贵在得法。教师备课时要从教学实际出发，根据教材特点、学生实际、本校条件等，结合不同的教学目标、内容、对象和条件，因校制宜、因时制宜，灵活、恰当地借鉴和选用国内外的教学方法，突出重点、攻破难点，并善于探讨、实践。（启示：首先、其次、最后）&lt;/p&gt;

&lt;p&gt;总之，教学其实就是教学有法、但无定法、贵在得法的过程。我会本着这样的理念在今后的教学实践中充分把握学生的学习特点，做到因材施教。（表态）&lt;/p&gt;

&lt;h3 id=&quot;2庄子说吾生而有涯而知也无涯请谈谈你对这句话的理解&quot;&gt;2、庄子说“吾生而有涯，而知也无涯”，请谈谈你对这句话的理解？&lt;/h3&gt;

&lt;p&gt;吾生也有涯，而知也无涯，这句话的意思是，人生是有限的，但是知识是无限的，学海无涯，对于教师来说，就是要树立终身学习的理念，做学习型的教师。&lt;/p&gt;

&lt;p&gt;首先，做学习型的教师是时代的要求，当今社会，科学技术发展迅速，教育教学技术也是日新月异，这就需要教师具备不断学习的能力。运用教育技术来优化课堂教学，提升教学效果，这样才能跟得上时代的步伐，不会被时代所淘汰。如果教师不能及时获得新知识，就很难为学生答疑解惑，无法胜任教书育人的职责。&lt;/p&gt;

&lt;p&gt;其次，&lt;ins&gt;教师工作的属性决定了教师既要教好书，更要育好人，这就要求教师既要掌握与时俱进的教学方法，&lt;/ins&gt;做学习型的教师有利于给学生提供更丰富的知识，知识是无限的，教师只有通过不断的学习，才能为学生带来源源不断的新知识。&lt;/p&gt;

&lt;p&gt;最后，做学习型的教师有利于教师自身的发展与进步，教师继续学习教育理论、教学实践技能和更新知识，&lt;ins&gt;拓宽视野&lt;/ins&gt;，往促进自己向更加优秀的方向发展，获取更大的成长空间。&lt;del&gt;实现教师自身发展的需要，教师要获得持续性的发展，就必须加强学习，拓宽视野，更新知识，只有这样，自己的职业生命才会更加精彩。&lt;/del&gt;&lt;/p&gt;

&lt;p&gt;因此，作为一名老师，在思想上我要树立终身学习的理念，认识到学习对自身发展和学生发展都有极其重要的意义。做一名学习型的教师，在行动上，我要更加积极的参加教研活动，向老教师请教，向互联网学习，潜心钻研，不断更新教育教学方法与教育教学手段，不断的提升自己。同时也要勇于创新，将教育理论和教育实践相结合，&lt;del&gt;结合教育理论和学生实际&lt;/del&gt;，&lt;ins&gt;总结规律和经验&lt;/ins&gt;，不断突破教法瓶颈，实现教学上的创新。考生答题完毕&lt;/p&gt;

&lt;h3 id=&quot;3班主任的日常工作&quot;&gt;3、班主任的日常工作&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;提出共同的奋斗目标。&lt;/li&gt;
  &lt;li&gt;选择和培养班干部。&lt;/li&gt;
  &lt;li&gt;培养正确的集体舆论和优良的班风。&lt;/li&gt;
  &lt;li&gt;加强对班集体纪律的管理。&lt;/li&gt;
  &lt;li&gt;组织多样的教育活动。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;4假如你是一名新生班主任你认为如何才能做好班主任工作&quot;&gt;4、假如你是一名新生班主任，你认为如何才能做好班主任工作？&lt;/h3&gt;

&lt;p&gt;第一，了解学生，可以和学生谈心、聊天或者召开班会等，了解每一位学生的具体特点。&lt;/p&gt;

&lt;p&gt;第二，组建强有力的班委，在对学生充分了解的基础上，采取民主投票的形式，组建班委，选出班长、学习委员、体育委员、团支书等学生干部。然后和学生一起制定本班的学习目标和学习、生活纪律。&lt;/p&gt;

&lt;p&gt;第三，记录学生成长，给每个学生建立成长记录袋，把学生的学习情况、生活情况、学校表现都一一记录在案，针对学生的每次表现给予全面、客观的评价。&lt;/p&gt;

&lt;p&gt;第四，组织活动，定期组织主题班会，促进学生发展，提高班级凝聚力。同时，经常性地组织一些课外活动，如体育比赛、演讲比赛、参观博物馆等活动，丰富学生的课外生活。&lt;/p&gt;

&lt;h3 id=&quot;5如果你的班上有一个学生学习成绩非常差很调皮经常去网吧上网但是他有围棋绘画等特长你会怎么办&quot;&gt;5、如果你的班上有一个学生学习成绩非常差、很调皮、经常去网吧上网，但是他有围棋、绘画等特长，你会怎么办？&lt;/h3&gt;

&lt;p&gt;（1）作为一名教师，我们要关注每一名学生的不同特点和个性，了解学生的具体特点，发扬积极因素，克服消极因素，扬长避短，长善救失，做到因材施教。&lt;/p&gt;

&lt;p&gt;（2）学生是发展中的人，作为一名教师，我们应该用发展的眼光来看待每一位学生的发展。&lt;/p&gt;

&lt;p&gt;（3）加强与这位学生的沟通、交流、对话，告知他去网吧的危害，学习的重要性，动之以情，晓之以理，讲道理，摆事实，用心打动这位学生。&lt;/p&gt;

&lt;p&gt;（4）作为一名教师，应加强与家长的沟通与交流，做好家校合作，形成教育合力，促进学生全面发展。&lt;/p&gt;

&lt;h3 id=&quot;6课堂教学中学习与实际操作结合起来你觉得这种做法合适吗&quot;&gt;6、课堂教学中，学习与实际操作结合起来，你觉得这种做法合适吗？&lt;/h3&gt;

&lt;p&gt;对于题目这种做法，我认为是非常合适的。教师如果能在课堂教学中把学习和应用实践结合起来，我认为对于学生的学习和教师自身的这种职业的发展和规划都是非常有利的，所以我认为这种做法很对。&lt;/p&gt;

&lt;p&gt;具体来说，一方面，他对于学生而言，在课堂教学过程中把学习和实践结合起来，能够帮助学生动手动脑提高学生这种综合学习的能力，包括实践操作能力。同时他也能充分的体现我们这种学以致用的教学理念，也能体现出以学生为主的这种教新课改的这种理念，比如说，我们比如以我教地理地位为例。就是我会可以将这个基础的这种知识啊跟实践的这种操结合起来那学生在操作过程中可能更加形象的理解。&lt;/p&gt;

&lt;p&gt;而另一方面呢，对于教师而言，在课堂上就能够做到将这个学习和这个操作结合起来，对于我们教师来说就会提出更高的要求，那就会督促我们教师不断地提高自己的教学水平，也会督促我们教师树立这种终身学习的理念，对于教师职业的发展有好处，对于学生的成长也非常有好处。&lt;/p&gt;

&lt;p&gt;总之在课堂教学中将两者结合起来，不管是对于学生还是对于老师都非常有好处，最重要的是我们如何去完善这个做法，我们可以不断的坚持，而且不断去完善，他完善教学的方法，从而使这种方法能够更好的运用到学生的教学过程中，促进学生帮我们发展。&lt;/p&gt;

&lt;h3 id=&quot;7有学生上课弄坏了教具老师将他罚出教室你怎么看2021-05-09&quot;&gt;7、有学生上课弄坏了教具，老师将他罚出教室，你怎么看？[2021-05-09]&lt;/h3&gt;

&lt;p&gt;考生开始作答，学生弄坏教具有可能是有意之举，有可能是无心之过，老师需要了解清楚原因之后再做妥善处理。而直接将学生罚出教师外，这个方式非常的简单粗暴，有可能会带来非常不利的教育影响，我是不赞同的。&lt;/p&gt;

&lt;p&gt;首先，第一点会侵犯学生的受教育权，每个学生都有平等的接受义务教育的权利，学生上课学到一半儿被罚出教室外，就失去了继续听课的机会，不利于他知识点的掌握，也不利于遵守法律法规教师职业道德和教师职业十项行为准则的基本要求，虽然这个动作小，但违背的教育理念非常的大。&lt;/p&gt;

&lt;p&gt;第二个方面，就是学生处在发展过程当中，他可能会犯错误，但此时老师的宽容越大，对于学生的成长来说更加重要，如果老师做出了过重的教育惩戒，就可能会导致这个学生的逆反心理，不利于进行下一步的教育。&lt;/p&gt;

&lt;p&gt;第三个方面，当学生心里埋怨老师很委屈的时候，就会加重老师和学生之间的矛盾，不利于师生之间良好关系的营造，也不利于继续去对学生进行教育和引导。&lt;/p&gt;

&lt;p&gt;综上所述，我认为老师的做法是不是妥当的。而如果我是这名老师，我会这样做，首先我要弄清楚它弄坏教具的原因，如果是无心之举，我会劝他安心地好好学习，如果是有意之举，我会引导他要爱护公共造句。总而言之，老师的每一个教育都应该是出于关爱学生的，只有在爱学生的基础上才能够达到良好的教育效果，我们也才能够更加接近四有好老师的这个目标。&lt;/p&gt;

&lt;h3 id=&quot;8马老师和学生打成一片校领导对他的教学方式遇见如果是你你该怎么办2021-05-09&quot;&gt;8、马老师和学生打成一片，校领导对他的教学方式遇见，如果是你，你该怎么办？[2021-05-09]&lt;/h3&gt;

&lt;p&gt;面对这种情况，我会这样的应对，首先我会虚心接受校领导对我教学方式提出的意见。&lt;/p&gt;

&lt;p&gt;其次，新课程背景下的教师观要求教师进行自我反思，和学生打成一片，有利有弊。一方面有利于深入学生群体，更好地发挥教育教学的效果；另一方面可能导致教师在学生中没有威信，因此针对校领导提出的教学方式，我会积极的反思存在的问题，采取改进措施，但并不是完全否定自己之前的做法。&lt;/p&gt;

&lt;p&gt;最后，作为一名教师应该做到终身学习，有针对性地调整自己的教学方式，不断的提高自己的教育教学水平。&lt;/p&gt;

&lt;h2 id=&quot;7综合分析&quot;&gt;（7）综合分析&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;社会现象
    &lt;ul&gt;
      &lt;li&gt;开头：简要表明对社会现象的看法。&lt;/li&gt;
      &lt;li&gt;分析：对原因、影响、问题、背景、现状等方面进行分析。&lt;/li&gt;
      &lt;li&gt;对策：提出对策，解决问题，落实观点。&lt;/li&gt;
      &lt;li&gt;结尾：简要总结，升华、拔高。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;态度观点类
    &lt;ul&gt;
      &lt;li&gt;亮明观点：点明主题，阐述启示。&lt;/li&gt;
      &lt;li&gt;分析论证：分析启示，论证观点。&lt;/li&gt;
      &lt;li&gt;落实启示：落实对策，将启示践行到日常工作中去。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;1有人说情商比智商重要你怎么看&quot;&gt;1、有人说，情商比智商重要，你怎么看？&lt;/h3&gt;

&lt;p&gt;考生开始作答。&lt;/p&gt;

&lt;p&gt;情商和智商，态度和能力，都是我们做好事情必须具备的重要方面和重要因素。
我认为，日常生活当中，这种情商比智商更关键的观点是有片面的，情商和智商都是非常重要。而且二者缺一不可。&lt;/p&gt;

&lt;p&gt;那我主要是从以下两个方面来谈一谈自己的一个看法。&lt;/p&gt;

&lt;p&gt;首先，情商是一个人处理好人际关系和人打交道更加顺畅的基础，我们每个人只有拥有了更好的情商并且能够热情，真诚的对待别人才能够在工作当中减少阻力、增加助力。让自己工作更加顺畅，减少不必要的麻烦。&lt;/p&gt;

&lt;p&gt;其次，一个人的智商和能力是提升工作水平和完成任务的一个基础，一个人不仅应该具有人际交往的能力和一个高智商，更应该具有基础的业务能力，无论在学校、其他单位中，都应该把本职工作做到极致，并且能够做好协作，把本领不断增进，才能够更好的适应职场。&lt;/p&gt;

&lt;p&gt;总而言之，如果将来有机会进入我们的教师队伍，我不仅要提升自己的业务能力，更会不断的提升自己的情商，让自己做到全面发展，更好地为学校做贡献，考生作答完毕。&lt;/p&gt;

&lt;h3 id=&quot;2有人说保护学生就是要像保护珍稀动物一样你同意吗&quot;&gt;2、有人说，保护学生就是要像保护珍稀动物一样，你同意吗？&lt;/h3&gt;

&lt;p&gt;学生作为人群当中相对的一个弱势群体，确实是应当给予一定的保护，但是如果说要像保护珍稀动物一样保护孩子，我个人觉得是有失偏颇的。原因主要有以下两个方面。&lt;/p&gt;

&lt;p&gt;第一，学生是有其主观能动性的，有正常的表达能力，并且在日常生活当中他们有自己的主见，面对不同的问题也有自己的想法，所以，家长和老师需要做的不是过分的事无巨细的保护，而是适当的&lt;del&gt;保护&lt;/del&gt;&lt;ins&gt;引导&lt;/ins&gt;和倾听就可以了。&lt;/p&gt;

&lt;p&gt;另外，如果对于孩子、对于学生在珍稀动物一样不让他们有任何的自我解决问题的能力，或者是面对挫折自我克服的能力，那么孩子即便是将来年龄成长了，成为了成年人，他们面对纷繁复杂的社会，面对日益加剧的学习和其他难题，可能也会导致他们在生活当中没有办法去独立面对，会让他们的成长变得非常的坎坷，这种保护对他们而言那都是有害无益的。&lt;/p&gt;

&lt;p&gt;综上所述，我认为，如果将来有幸成为一个老师，或者在以后成为一个家长，我会尽可能的在尊重孩子的基础之上，去适度的保护他们，让他们拥有自己成长的能力、独立思考能力和独立生活能力，从而成就他们更出色的自己，考生作答完毕。&lt;/p&gt;

&lt;h3 id=&quot;3新时期中小学教师职业行为十项准则你怎么理解&quot;&gt;3、新时期中小学教师职业行为十项准则，你怎么理解？&lt;/h3&gt;

&lt;p&gt;考生思考完毕，下面开始作答。对比新时代出台的教师职业行为十项准则我是赞成的，具体理由如下。&lt;/p&gt;

&lt;p&gt;从准则出台的必须性来看，老师是人类灵魂的工程师，不仅要教好书，还要育好人，各方面都要为人师表。制定教师职业行为准则，明确新时代教师职业规范，针对主要问题，突出问题，划定基本底线，对广大教师的警醒提示和严管厚爱，是深化十分建设造就政治素养过硬业务能力精湛育人水平高超的高素质教师队伍的关键之举，也是教师严格自我约束，规范职业行为，加强自我修养提供了基本遵循。&lt;/p&gt;

&lt;p&gt;另外一个方面，从民族发展的教师职业重要性来看，作为一名教师是非常光荣的，要有高度的事业心和责任感，教师对人培养和文化事业的发展起着至关重要的作用，要做好教师工作，就必须依赖不热爱工作，忠诚教育事业是教师职业道德的灵魂。&lt;/p&gt;

&lt;p&gt;作为教师，榜样的力量是无穷的，身教必要，终于言教，要在自己的职业道德方面追求卓越，追求更高标准，这是构建我们未来民族道德素质的基础。&lt;/p&gt;

&lt;p&gt;最后呢，从育人的教师职业特点来看，我们要立足准则，遵照准则，要更加珍爱和珍惜教师职业，教师作为一个职业，显然他是一个谋生的手段，但是从社会良心上看，它是生命影响生命的良心活。&lt;/p&gt;

&lt;p&gt;因此，我们应该珍惜人民的教育事业，热爱教育事业，社会主义教育事业是崇高而伟大的事业，我们每一位教师都应该热爱事业和热爱我们的学生，才能够去尊重我们学生的人格，引导我们学生更好地成才。&lt;/p&gt;

&lt;p&gt;所以，综上所述，我认为我们一定要按照准则来更好地规范自己，促进自己的教师职业不断健康发展，考生作答完毕。&lt;/p&gt;

&lt;h3 id=&quot;4校长认为应该以升学率作为第一目标你觉得对吗&quot;&gt;4、校长认为应该以升学率作为第一目标，你觉得对吗？&lt;/h3&gt;

&lt;p&gt;考生思考完毕，下面开始作答。在我看来，校长将升学率作为第一目标显然是不科学的，我们现在的教育目标已经从原有的应试教育转化成素质教育，所以身为校长更应该带头加强学校的素质教育建设与发展。&lt;/p&gt;

&lt;p&gt;首先，我们不可否认的是升学率是学校发展的重要任务，但是我们更要认识到一所学校的加工能力绝不仅仅是成绩的提升和对比。更是一所学校在固有的条件下对学生素质全面打造培养的一个场所，换句话说教育应该是教会学生如何去学，如何成为一个全面发展的人，而不仅仅是学生在若干人在重要考试中取得一个不错的成绩，这样就好了。&lt;/p&gt;

&lt;p&gt;况且，我们现在的这个素质教育而是新时代教育的一个重要转折，更应该去注重核心素养的养成，核心素养作为我们教育的起点，强调以培养全面发展为核心，更为重视我们的文化基础、自主发展、社会参与等三个方面，在这样的环境下评价一所学校学生的指标，更应该是综合化和多元化的。&lt;/p&gt;

&lt;p&gt;因此，我们在成绩评价的基础之上，要不断学加以完善，从而促进自身学学生和学校的全面发展，考生作答完毕&lt;/p&gt;

&lt;h2 id=&quot;8时事政治&quot;&gt;（8）时事政治&lt;/h2&gt;

&lt;h3 id=&quot;1不忘初心牢记使命的含义是什么&quot;&gt;1、“不忘初心、牢记使命”的含义是什么？&lt;/h3&gt;

&lt;p&gt;“不忘初心，牢记使命”。习总书记在党的十九大报告中指出：“中国共产党人的初心和使命，就是为中国人民谋幸福，为中华民族谋复兴。”&lt;/p&gt;

&lt;p&gt;作为一名人民教师，我的初心就是全心全意为人民服务、为学生服务，使命就是教育好学生，促进学生全面发展，做到“xx”，我会在工作中从以下几个方面发展：&lt;/p&gt;

&lt;p&gt;首先，我要加强学习。学习党的理论方针政策，学习本学科的专业知识，保持真诚，谦虚的态度，向领导，前辈，同事学习请教。学习教育教学的基本规律，向实践学习，向前辈学习。&lt;/p&gt;

&lt;p&gt;其次，我会把学生放在心上。把学生当做亲人，想学生之所想，急学生之所急，努力帮助学生解决实际困难和问题。真正成为学生的支持者，引导者，帮助者，促进者。&lt;/p&gt;

&lt;p&gt;最后，我会把“不忘初心、牢记使命”落实到工作中来，严格要求自己，加强组织纪律性，不断提升自己，修剪欲望，茁壮心灵，抵制诱惑，做到清净自守。我会耐得住寂寞，守得住清贫，抵得住诱惑，稳得住心神。&lt;/p&gt;

&lt;h3 id=&quot;2我国2035年的奋斗目标是什么&quot;&gt;2、我国2035年的奋斗目标是什么？&lt;/h3&gt;

&lt;p&gt;谢谢考官，考生开始答题。我国2035年的奋斗目标是在全面建成小康社会的基础上，再奋斗15年，&lt;strong&gt;基本实现社会主义现代化&lt;/strong&gt;，要全实现社会主义现代化的话，教育也起着至关重要的作用，作为一名人民教师的话，我也会身体力行的去响应党和国家的号召，具体的我会从以下几个方面来严格要求自己。&lt;/p&gt;

&lt;p&gt;第一，加强学习。学习党的理论方针政策，学习本学科的专业知识，保持真诚，谦虚的态度，向领导，前辈，同事学习请教。学习教育教学的基本规律，向实践学习，向前辈学习。&lt;/p&gt;

&lt;p&gt;其次，我会把学生放在心上。把学生当做亲人，想学生之所想，急学生之所急，努力帮助学生解决实际困难和问题。真正成为学生的支持者，引导者，帮助者，促进者。&lt;/p&gt;

&lt;p&gt;最后，我会严格要求自己，加强组织纪律性，不断提升自己，修剪欲望，茁壮心灵，抵制诱惑，做到清净自守。我会耐得住寂寞，守得住清贫，抵得住诱惑，稳得住心神。&lt;/p&gt;

&lt;h3 id=&quot;3谈谈你对四有好老师的理解&quot;&gt;3、谈谈你对“四有好老师”的理解&lt;/h3&gt;

&lt;p&gt;习总书记强调广大教师要做“有理想信念，有道德情操，有扎实知识、有仁爱之心”的好老师，为发展具有中国特色、世界水平的现代教育，培养社会主义事业建议者和接班人作出更大贡献。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;有理想信念，这是实现中国梦的思想基础，体现了思想育人的导向。
有道德情操，这是教书育人的前提条件，体现了道德育人的导向。
有扎实知识，这是对教师的起码要求，体现了知识育人的导向。
有仁爱之心，这是教师从事的职业所需，体现了和谐育人的导向。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;做到好教师，具体的我会从以下几个方面来严格要求自己。&lt;/p&gt;

&lt;p&gt;第一，加强学习。学习党的理论方针政策，学习本学科的专业知识，保持真诚，谦虚的态度，向领导，前辈，同事学习请教。学习教育教学的基本规律，向实践学习，向前辈学习。&lt;/p&gt;

&lt;p&gt;其次，我会把学生放在心上。把学生当做亲人，想学生之所想，急学生之所急，努力帮助学生解决实际困难和问题。真正成为学生的支持者，引导者，帮助者，促进者。&lt;/p&gt;

&lt;p&gt;最后，我会严格要求自己，加强组织纪律性，不断提升自己，修剪欲望，茁壮心灵，抵制诱惑，做到清净自守。我会耐得住寂寞，守得住清贫，抵得住诱惑，稳得住心神。&lt;/p&gt;

&lt;h3 id=&quot;4大先生是什么&quot;&gt;4、大先生是什么&lt;/h3&gt;

&lt;p&gt;开始答题：大先生，在教师这方面指的是教师不能只做传授书本知识的教书匠，也要成为塑造学生品格品行和品味的大先生。&lt;/p&gt;

&lt;p&gt;作为一名教师，我们要恪守教师职业道德规范，真正做到爱国守法、爱岗敬业、关爱学生、教书育人、为人师表、终身学习。&lt;/p&gt;

&lt;p&gt;其次，我们要在教学过程中应该发挥教师的主导作用，尊重学生的主体地位，启发诱导学生，不断调动学生学习的积极性主动性和创造性。要做到关爱学生，加强与学生的沟通与交流，对学生的品格和思想进行指导，做学生的良师益友。&lt;/p&gt;

&lt;p&gt;最后，我应该加强学习。学习党的理论方针政策，学习本学科的专业知识，保持真诚谦虚的态度，向领导、同事请教，学习教育教学的基本规律，向实践学习。为培育更多有理想、有本领、有担当的接班人作出自己的贡献。&lt;/p&gt;

&lt;p&gt;考生回答完毕。&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;学习教育教学能力。&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;5习近平提出的幸福感你怎么看&quot;&gt;5、习近平提出的幸福感，你怎么看？&lt;/h3&gt;

&lt;p&gt;考生开始答题。我认为成为一名优秀的人民教师就是我的幸福，实现我的幸福我会做到以下几点：&lt;/p&gt;

&lt;p&gt;第一，我会加强学习学习党的理论方针政策，学习本岗位业务知识，提高自己的业务能力，提高自己为学生为学校服务的意识和能力，在我看来，为学生为学校服务就是我的幸福。&lt;/p&gt;

&lt;p&gt;第二，我会尊重领导，服从领导安排，维护领导权威，认真完成领导交给的各项工作任务，在我看来，这就是我的幸福。&lt;/p&gt;

&lt;p&gt;第三，我会时刻把学生放在心上，把学生当作亲人，想学生之所，想急学生之所急，努力帮助学生解决实际困难和问题。我认为帮助学生就是我的幸福。&lt;/p&gt;

&lt;p&gt;第四，我会严格要求自己，加强组织纪律性，不断提升自己，修剪欲望，茁壮心灵，抵制诱惑。做到清净自守，我会耐得住寂寞，守得住清贫，抵得住诱惑，稳得住心神。&lt;/p&gt;

&lt;p&gt;总之，为培育更多有理想、有本领、有担当的接班人作出自己的贡献。这就是我的幸福。&lt;/p&gt;

&lt;h3 id=&quot;6习近平提出要爱国守法爱岗敬业作为教师你应该怎么做&quot;&gt;6、习近平提出要“爱国守法，爱岗敬业”，作为教师，你应该怎么做&lt;/h3&gt;

&lt;p&gt;考生开始答题。爱国守法爱岗敬业是中小学教师职业道德规范里的要求，爱国是一个人民教师的首要的政治规范手法，是一个人民教师的最基本的行为准则。&lt;/p&gt;

&lt;p&gt;爱国守法，我们应该做到，热爱祖国热爱人民，拥护中国共产党的领导，拥护社会主义，全面贯彻国家教育方针，自觉遵守教育法律法规，依法履行教师的职业职责权利，不得有悖党和国家方针政策的言行。&lt;/p&gt;

&lt;p&gt;爱岗敬业是我们教师的职业道德底线，要做到爱岗敬业，我们应该忠于人民教育事业，志存高远，勤恳敬业，甘为人梯，乐于奉献，对工作高度负责，认真备课、上课、认真批改作业，认真辅导学生。&lt;/p&gt;

&lt;p&gt;因此，作为人民教师，我们要在工作和生活中坚持教师的职业道德规范，履行人民教师的神圣职责，用我们的辛勤劳动和无私奉献，去培育出更多的、优秀的、合格的社会主义接班人。考生作答完毕&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>回归.NET冷门技术之WPF</title>
   <link href="https://comeround.cn/article/turn-to-wpf.html"/>
   <updated>2020-12-04T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/turn-to-wpf</id>
   <content type="html">&lt;h2 id=&quot;一前言&quot;&gt;一、前言&lt;/h2&gt;

&lt;p&gt;很多人说，PHP语言会用得越来越少，有一些PHPer都在努力的转Java，但是我并不担心这些，因为我不确定我在这条路上走多远。&lt;/p&gt;

&lt;p&gt;我是从2014年夏天实训时开始学习编程的，那时候是从winform开始，拖控件、写简易交互便开始了。&lt;/p&gt;

&lt;p&gt;但是从2016年接触PHP之后，我并不对.NET系列感冒，后来基本没接触.NET。在最近PHP使用中，觉得phpenv就做得很不错。以前做的winform只是可以搭配一些控件而已，却从没做过美化，而phpenv不仅是功能和界面，都是比较不错的。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/wpf-phpenv.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;现在，就“多一门语言，多一点技术”，重新学习一下WPF，尝试着做出一个小小的WPF程序，维护一个程序，才能逐步提高该方面的技术。&lt;/p&gt;

&lt;p&gt;在WPF开发中，我有以下疑问：&lt;/p&gt;

&lt;p&gt;（1）从开始学习窗体程序，是使用本地.NET调用本地SQLServer数据库的，如果多人使用系统，那么这种方式就不行了。&lt;/p&gt;

&lt;p&gt;必须使用网络编程，使服务器和客户端是一对多的。那么，就得借助TCP/UDP网络编程，而TCP/IP协议中，使用http最为方便，可以使其他语言作为服务器，并且可以搭建在Linux服务器中，为保证程序的安全性，尽量使用https作为连接。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;认识.NET&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.NET&lt;/code&gt;是一种用于构建多种应用的免费开源开发平台，可以使用多种语言，编辑器和库开发Web应用、Web API和微服务、云中的无服务器函数、云原生应用、移动应用、桌面应用、Windows WPF、Windows窗体、通用 Windows平台 (UWP)、游戏、物联网 (IoT)、机器学习、控制台应用、Windows服务。.NET类库在不同应用和应用类型中共享功能，无论构建哪种类型的应用，代码和项目文件看起来都一样，可以访问每个应用的相同运行时、API和语言功能。&lt;/p&gt;

&lt;h3 id=&quot;net相关版本&quot;&gt;.NET相关版本&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;版本号&lt;/th&gt;
      &lt;th&gt;发布时间&lt;/th&gt;
      &lt;th&gt;生命周期&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET 5.0 (推荐 5.0.0)&lt;/td&gt;
      &lt;td&gt;2020-11-10&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Core 3.1 (LTS-3.1.10)&lt;/td&gt;
      &lt;td&gt;2019-12-03&lt;/td&gt;
      &lt;td&gt;2022-12-03&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Core 2.1 (LTS-2.1.23)&lt;/td&gt;
      &lt;td&gt;2018-05-30&lt;/td&gt;
      &lt;td&gt;2021-08-21&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Framework 4.8 (推荐)&lt;/td&gt;
      &lt;td&gt;2019-04-18&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Framework 4.7.2&lt;/td&gt;
      &lt;td&gt;2018-04-30&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Framework 4.7.1&lt;/td&gt;
      &lt;td&gt;2017-10-17&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Framework 4.7&lt;/td&gt;
      &lt;td&gt;2017-04-05&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Framework 4.6.2&lt;/td&gt;
      &lt;td&gt;2016-08-02&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Framework 4.6.1&lt;/td&gt;
      &lt;td&gt;2015-11-30&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Framework 4.6&lt;/td&gt;
      &lt;td&gt;2015-07-20&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Framework 4.5.2&lt;/td&gt;
      &lt;td&gt;2014-05-05&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Framework 4.5.1&lt;/td&gt;
      &lt;td&gt;2013-10-17&lt;/td&gt;
      &lt;td&gt;2016-01-12&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Framework 4.5&lt;/td&gt;
      &lt;td&gt;2012-08-15&lt;/td&gt;
      &lt;td&gt;2016-01-12&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Framework 4.0&lt;/td&gt;
      &lt;td&gt;2010-04-12&lt;/td&gt;
      &lt;td&gt;2016-01-12&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Framework 3.5 SP1&lt;/td&gt;
      &lt;td&gt;2008-11-18&lt;/td&gt;
      &lt;td&gt;2028-10-10&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;c语言版本&quot;&gt;C#语言版本&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;目标框架&lt;/th&gt;
      &lt;th&gt;version&lt;/th&gt;
      &lt;th&gt;C#语言版本的默认值&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET&lt;/td&gt;
      &lt;td&gt;5.x&lt;/td&gt;
      &lt;td&gt;C# 9.0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Core&lt;/td&gt;
      &lt;td&gt;3.x&lt;/td&gt;
      &lt;td&gt;C# 8.0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Core&lt;/td&gt;
      &lt;td&gt;2.x&lt;/td&gt;
      &lt;td&gt;C# 7.3&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Standard&lt;/td&gt;
      &lt;td&gt;2.1&lt;/td&gt;
      &lt;td&gt;C# 8.0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Standard&lt;/td&gt;
      &lt;td&gt;2.0&lt;/td&gt;
      &lt;td&gt;C# 7.3&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Standard&lt;/td&gt;
      &lt;td&gt;1.x&lt;/td&gt;
      &lt;td&gt;C# 7.3&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;.NET Framework&lt;/td&gt;
      &lt;td&gt;全部&lt;/td&gt;
      &lt;td&gt;&amp;lt; C# 7.3&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://dotnet.microsoft.com/download/dotnet/5.0&quot;&gt;Download .NET 5.0&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/zh-cn/dotnet/csharp/language-reference/configure-language-version&quot;&gt;C#语言版本控制&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.cnblogs.com/MingsonZheng/p/11273700.html&quot;&gt;C#版本与.NET版本对应关系以及各版本的特性&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/zh-cn/dotnet/csharp/whats-new/csharp-version-history&quot;&gt;C#历史版本&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;二url请求登录&quot;&gt;二、URL请求登录&lt;/h2&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;HttpWebRequest&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HttpWebRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WebRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Method&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;POST&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Referer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Referer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UTF8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetBytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ContentType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;application/json&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ContentLength&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UserAgent&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;JinPinJiaoYu/1.0.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Headers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Authorization&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;None&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//自定义头部&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Stream&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myResponseStream&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetRequestStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;myResponseStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;HttpWebResponse&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HttpWebResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;StreamReader&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myStreamReader&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;StreamReader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetResponseStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UTF8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;retString&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myStreamReader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ReadToEnd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;myStreamReader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;myResponseStream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;response&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Abort&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;retString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;三界面&quot;&gt;三、界面&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/wpf-login.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/wpf-login-2.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;四语法功能&quot;&gt;四、语法功能&lt;/h2&gt;

&lt;h3 id=&quot;获取本地ip&quot;&gt;获取本地IP&lt;/h3&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;System.Net&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;///获取本地的IP地址&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AddressIP&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Empty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IPAddress&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_IPAddress&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Dns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetHostEntry&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Dns&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetHostName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AddressList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_IPAddress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AddressFamily&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ToString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;InterNetwork&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;AddressIP&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_IPAddress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ToString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AddressIP&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;控件显示网络图片&quot;&gt;控件显示网络图片&lt;/h3&gt;

&lt;p&gt;https://blog.csdn.net/qq_42026964/article/details/100115873&lt;/p&gt;

&lt;h3 id=&quot;下载网络图片&quot;&gt;下载网络图片&lt;/h3&gt;

&lt;p&gt;https://www.cnblogs.com/guxin/p/csharp-download-binary-file.html&lt;/p&gt;

&lt;h2 id=&quot;五其他功能&quot;&gt;五、其他功能&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.csdn.net/lindexi_gd/article/details/51115893&quot;&gt;WPF托盘显示&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzIxODE1OTIzOA==&amp;amp;mid=2247484880&amp;amp;idx=1&amp;amp;sn=997893b4959fb4673b8660651fd352c9&amp;amp;chksm=97ef8439a0980d2f15e42a877e73f334566a5eda2ff68fcea41253040c2d8f174ad83f7b146d&amp;amp;mpshare=1&amp;amp;scene=1&amp;amp;srcid=1206P0QNskd5pAEYXEerdblg&amp;amp;sharer_sharetime=1607238067925&amp;amp;sharer_shareid=37ee1a4098b78fb47058be76f609635d&amp;amp;key=f4c334f5d6d13eef1092388fadc147ae5c1e65320689115e71482b249a9a692525fc5d7760e1c54810635805d417d722cadf9a3d436cf50443563da27b016ebeed3ffd59100483c73c953643ba28a4c672c5685cdd90f58f7da4181a95bdb2ab7d465c12dfe1a89c20daf1788532d0c7df21b5d85c472aac23d2f819704035ee&amp;amp;ascene=1&amp;amp;uin=MTgwNDM3NzYxOA%3D%3D&amp;amp;devicetype=Windows+10+x64&amp;amp;version=6300002f&amp;amp;lang=zh_CN&amp;amp;exportkey=A4lOTH111dlB2Oz1Jj5nnuU%3D&amp;amp;pass_ticket=q1FplrHWDOtItZdQ%2FecH1I2%2FyePCljZGE5MUVNMB%2BlxJ16M4ZKs97cJXQf8z4%2BJh&amp;amp;wx_header=0&quot;&gt;其他页面（上面程序就是参照第一个做的）&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.pianshen.com/article/86401619629/&quot;&gt;VS2019简单快速的打包exe文件(图文教程)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.bilibili.com/video/BV17K41157W1?from=search&amp;amp;seid=16166934633218001076&quot;&gt;打包视频教程Inno Setup 6&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;也可以用winRAR打包&lt;/p&gt;

&lt;h2 id=&quot;六项目参考&quot;&gt;六、项目参考&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;https://github.com/sajjad-z/Login-Page-WPF             # 用户登录页面

https://github.com/sajjad-z/WPF-DataTable-Dashboard    # 表格加载页面

https://github.com/sajjad-z/WPF-Input-Form.git         # 信息输入页面
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>页面样式</title>
   <link href="https://comeround.cn/article/page-style.html"/>
   <updated>2020-08-08T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/page-style</id>
   <content type="html">&lt;style&gt;
.img-thumbnail {
    display: inline-block;
    max-width: 100%;
    height: auto;
    padding: 4px;
    line-height: 1.42857143;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    -webkit-transition: all .2s ease-in-out;
    -o-transition: all .2s ease-in-out;
    transition: all .2s ease-in-out;
	vertical-align: middle;
	width: 200px;
}
div.word&gt;span{
	margin: 10px 2px;
	font-size: 20px;
	color: #555;
	font-weight: bold;
	text-align: center;
	vertical-align: middle;
	padding: 4px;
	border: 1px solid rgb(128,191,75);
	border-radius: 3px;
	background-color: rgb(192,222,156);
}
&lt;/style&gt;

&lt;p&gt;遍历文字系列各种图片&lt;/p&gt;

&lt;div class=&quot;word&quot; style=&quot;display:flex;&quot;&gt;

	&lt;span&gt;Java&lt;/span&gt;

	&lt;span&gt;PHP&lt;/span&gt;

	&lt;span&gt;Python&lt;/span&gt;

	&lt;span&gt;Nodejs&lt;/span&gt;

	&lt;span&gt;.NET Core&lt;/span&gt;

	&lt;span&gt;Vue&lt;/span&gt;

	&lt;span&gt;React&lt;/span&gt;

	&lt;span&gt;ReactNative&lt;/span&gt;

	&lt;span&gt;Android&lt;/span&gt;

	&lt;span&gt;IOS&lt;/span&gt;

	&lt;span&gt;Flutter&lt;/span&gt;

	&lt;span&gt;C#&lt;/span&gt;

	&lt;span&gt;C++&lt;/span&gt;

	&lt;span&gt;C&lt;/span&gt;

&lt;/div&gt;

&lt;h1 id=&quot;这是h1-swoft微服务框架&quot;&gt;这是H1-Swoft微服务框架&lt;/h1&gt;

&lt;p&gt;如开始介绍的，在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;智慧政务&lt;/code&gt;应用中，对于一些地方的扶贫产品推荐，需要为这些产品生成相应的宣传海报，在生成海报图片的过程中，对于产品标题、副标题等文案信息，也希望是自动化生成，根据实际情况，这些产品信息往往会由商家提供一个比较详细的文本信息说明，有可能还会配以图片，因此是希望从这些较细致、长篇幅的描述文本信息、结合图片等信息，自动化的生成摘要信息。&lt;/p&gt;

&lt;h2 id=&quot;这是h2-服务器性能优化&quot;&gt;这是H2-服务器性能优化&lt;/h2&gt;

&lt;p&gt;如开始介绍的，在&lt;del&gt;智慧政务应用&lt;/del&gt;中，对于一些地方的扶贫产品推荐，需要为这些产品生成相应的宣传海报，在生成海报图片的过程中，对于产品标题、副标题等文案信息，也希望是自动化生成，根据实际情况，这些产品信息往往会由商家提供一个比较详细的文本信息说明，有可能还会配以图片，因此是希望从这些较细致、长篇幅的描述文本信息、结合图片等信息，自动化的生成摘要信息。&lt;/p&gt;

&lt;h3 id=&quot;这是h3-算法与数据结构&quot;&gt;这是H3-算法与数据结构&lt;/h3&gt;

&lt;p&gt;如开始介绍的，在&lt;em&gt;智慧政务应用&lt;/em&gt;中，对于一些地方的扶贫产品推荐，需要为这些产品生成相应的宣传海报，在生成海报图片的过程中，对于产品标题、副标题等文案信息，也希望是自动化生成，根据实际情况，这些产品信息往往会由商家提供一个比较详细的文本信息说明，有可能还会配以图片，因此是希望从这些较细致、长篇幅的描述文本信息、结合图片等信息，自动化的生成摘要信息。&lt;/p&gt;

&lt;h4 id=&quot;这是h4-分布式缓存消息中间件&quot;&gt;这是H4-分布式缓存/消息中间件&lt;/h4&gt;

&lt;p&gt;如开始介绍的，在智慧政务应用中，对于一些地方的扶贫产品推荐，需要为这些产品生成相应的宣传海报，在生成海报图片的过程中，对于产品标题、副标题等文案信息，也希望是自动化生成，根据实际情况，这些产品信息往往会由商家提供一个比较详细的文本信息说明，有可能还会配以图片，因此是希望从这些较细致、长篇幅的描述文本信息、结合图片等信息，自动化的生成摘要信息。&lt;/p&gt;

&lt;h5 id=&quot;这是h5-php架构师教程&quot;&gt;这是H5-PHP架构师教程&lt;/h5&gt;

&lt;p&gt;如开始介绍的，在智慧政务应用中，对于一些地方的扶贫产品推荐，需要为这些产品生成相应的宣传海报，在生成海报图片的过程中，对于产品标题、副标题等文案信息，也希望是自动化生成，根据实际情况，这些产品信息往往会由商家提供一个比较详细的文本信息说明，有可能还会配以图片，因此是希望从这些较细致、长篇幅的描述文本信息、结合图片等信息，自动化的生成摘要信息。&lt;/p&gt;

&lt;h6 id=&quot;这是h6-战旗tv视频直播的架构项目实战&quot;&gt;这是H6-战旗TV视频直播的架构项目实战&lt;/h6&gt;

&lt;p&gt;如开始介绍的，在智慧政务应用中，对于一些地方的扶贫产品推荐，需要为这些产品生成相应的宣传海报，在生成海报图片的过程中，对于产品标题、副标题等文案信息，也希望是自动化生成，根据实际情况，这些产品信息往往会由商家提供一个比较详细的文本信息说明，有可能还会配以图片，因此是希望从这些较细致、长篇幅的描述文本信息、结合图片等信息，自动化的生成摘要信息。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;以下是P标签的内容&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;
	&lt;span style=&quot;background-color: rgb(30, 155, 232);padding:6px 12px;border-radius: 2px;color:#fefefe;&quot;&gt;5&lt;/span&gt;
	&lt;span style=&quot;background-color: rgb(123, 196, 241);padding:6px 12px;border-radius: 2px;color:#ffffff;&quot;&gt;训练和预测&lt;/span&gt;
&lt;/p&gt;

&lt;p&gt;&lt;span&gt;「像这样的女司机我们不予评论，我们的态度是一贯的、明确的，我们始终坚持一辆车只贴一个实习贴，我们希望这个女司机回到正确的轨道上来，否则产生的后果完全由女司机承担。」&lt;/span&gt;&lt;/p&gt;

&lt;div style=&quot;background-color:rgba(197, 227, 211, 0.34);margin-bottom:10px;&quot;&gt;
	&lt;span style=&quot;display: inline-block;
    width: 50px;
    height: 50px;
    vertical-align: top;
    overflow: hidden;
    border-radius: 0% 100px 100px 0%;
    border-width: 0px;
    border-style: none;
    border-color: rgb(62, 62, 62);
    background-color: rgb(111, 186, 131);color:#fff;
	font-weight:600;
	padding:12px;&quot;&gt;
01
	&lt;/span&gt;
	&lt;span style=&quot;color:rgb(83, 118, 105);padding:8px;display:inline-block;font-size:20px;&quot;&gt;
		影响人格形成的因素
	&lt;/span&gt;
&lt;/div&gt;

&lt;div class=&quot;text-box t1&quot;&gt;生物遗传因素&lt;/div&gt;
&lt;div class=&quot;text-box t2&quot;&gt;社会文化因素&lt;/div&gt;
&lt;div class=&quot;text-box t3&quot;&gt;学校教育因素&lt;/div&gt;
&lt;div class=&quot;text-box t4&quot;&gt;家庭因素&lt;/div&gt;
&lt;div class=&quot;text-box t5&quot;&gt;个人主观因素&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;路由器类型&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;double-box&quot;&gt;
	&lt;span&gt;路由器组网主要应用在大型企业、行业的广域网专网的组网环境中&lt;/span&gt;
&lt;/div&gt;

&lt;p&gt;任务名称&lt;/p&gt;

&lt;p style=&quot;display: initial;background-color: #f9f8f8;
border-top: 1px solid #40B8FA;
border-radius: 2px;
padding: 5px 14px;
box-shadow: 1px 3px 6px #bbb;
color: #0c8ecf;font-size: 18px;
&quot;&gt;
重点任务
&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;这是默认blockquote&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote class=&quot;info&quot;&gt;
  &lt;p&gt;这是标准信息info&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote class=&quot;success&quot;&gt;
  &lt;p&gt;这是成功信息success&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote class=&quot;danger&quot;&gt;
  &lt;p&gt;这是危险信息danger&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote class=&quot;warning&quot;&gt;
  &lt;p&gt;这是警告信息warning&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote class=&quot;default&quot;&gt;
  &lt;p&gt;这是default信息&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;blockquote&gt;
    &lt;p&gt;这是二级缓冲池的管理&lt;/p&gt;
  &lt;/blockquote&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;读数据操作&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;重做日志缓冲&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;什么时候刷新到磁盘？&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p style=&quot;margin-top: 10px;
    padding: 3px;
    max-width: 100%;
    border-radius: 20px;
    border-width: 1px;
    border-style: dashed;
    border-color: rgb(215, 142, 122);
    color: rgb(6, 6, 6);
    text-align: center;
    box-sizing: border-box !important;
    overflow-wrap: break-word !important;&quot;&gt;
赞是一种肯定 | 分享是一种支持
&lt;/p&gt;

&lt;style&gt;.post&gt;div&gt;p{text-indent:2em;margin-bottom: 5px;}
&lt;/style&gt;

&lt;div style=&quot;border: 1px solid #48d491;color:#35b276;border-radius: 9px;padding: 6px 6px 6px 10px;font-size: 14px;margin-bottom: 9px;&quot;&gt;
&lt;p&gt;过年时，我县团委牵头，县里的很多商家赞助，举办了一场相亲大会。去年5月份时我就收到通知了，由村干部通知上报参加的大龄未婚男女青年。我特意提前请假一个星期回老家参加，特意提前收拾好了自己。&lt;/p&gt;&lt;p&gt;
那天的头一天我父亲骑车去踩点，第二天天不亮我妈就起床做饭，然后吃完早饭，我父亲骑着三轮车拉着我和我妈去。&lt;/p&gt;&lt;p&gt;
9点多到了后，说是下午14点才开始，我们就在那里等着。&lt;/p&gt;&lt;p&gt;
下午14点陆续的开始进场，大概有100多人，刚开始是个人表演，好多男的去舞台高唱一曲，而我什么都不会，只能默默的坐在下面。后来又有很多游戏活动，我都没上去。最后一个节目是配对活动，什么穿线之类的，我看中了一个姑娘，我上去献殷勤，结果她立刻转身不搭理我。我就默默的找个座位坐着。&lt;/p&gt;&lt;p&gt;
最后我才知道，参加那些女的都是托，有些是学生，有些是商家的店员，凑数每人发300元钱。&lt;/p&gt;&lt;p&gt;
结束后，我父亲骑三轮车带着我和我妈回去了，收获了一堆广告页和好多广告赠品。我妈也没有了来时的那种期望和高兴。&lt;/p&gt;
&lt;/div&gt;

&lt;div style=&quot;border: 2px dotted #a1a1aa;color:#333;border-radius: 9px;padding: 6px 6px 6px 10px;font-size: 14px;margin-bottom: 9px;&quot;&gt;
&lt;p&gt;这个耍着木棒大闹课堂的小子是不是读书无用论的产物？谁能治得了他？早年，在所谓精英教育时期，村子里能考上一个大学生，是极其轰动的事情，整个家庭在村子里都很有颜面。后来时兴全民经商，考上大学就不见得比下海经商混得好。又后来，高等教育大众化，考上大学的孩子又不见得比辍学学个理发修车等技术挣得多。再后来，村子里那些考上大学的一般家庭孩子在外面混得还不如村干部没考上大学的孩子开个饭店办个私立中小学混的风生水起。&lt;/p&gt;&lt;p&gt;
几十年后，那些早年以优异成绩考上大学的所谓村民榜样，大部分也没有混出一官半职，甚至泯然众人矣。于是很多学生家长就不再看重孩子的成绩，转向重点教孩子在学校不能太老实，因为老实人会吃亏。也便有了以能够欺负别人，做个混世魔王为乐的土壤和恶之花。一些有点背景的孩子也越来越变得教不得，惹不得，碰不得。&lt;/p&gt;&lt;p&gt;
教育，是为社会培养什么样的人的根本途径，教育是美好的理想，但同时又很现实，社会环境也是一个很重要的无声课堂。&lt;/p&gt;
&lt;/div&gt;

&lt;div style=&quot;border: 2px dotted #a1a1aa;color:#333;border-radius: 9px;padding: 6px 6px 6px 10px;font-size: 14px;margin-bottom: 9px;&quot;&gt;
&lt;div style=&quot;font-size:22px;&quot;&gt;大多数大学生的悲哀&lt;/div&gt;

&lt;p&gt;

我好想逃，却逃不掉&lt;/p&gt;&lt;p&gt;

这句歌词精准地反应了很多年轻人对生活的无奈，同时也揭露了他们身上的一个通病——习惯逃避现实。&lt;/p&gt;&lt;p&gt;

不满足寒窗苦读十几年却只能收获基本工资的惨烈现实，不少年轻人试图寻找各种新出路，创业、读研读博、待家啃老，但是无论哪一种，最终都要面对现实，现在很讽刺的就是一个读书人从家里拿了一米口袋的钱，读完后书卖了得到一个米口袋 父母辛苦教育出来的大学生，结果还不如上一代，压力之大可想而知，除了是大学生的头衔，一无所有，还有可能因为大学生这个身份苦恼。&lt;/p&gt;&lt;p&gt;

家人、邻居说三道四的，说什么读了大学也还不是那个样，没有点成就反而会成为自己的累赘，连读书人的那点尊严都护不住。&lt;/p&gt;&lt;p&gt;

如果没有家庭背景，全程靠自己，在这个时代就只能是那种能吃饱饿不死—也就是活着，一眼就忘到头的生活，如果是一个男孩子的话，就更加难上加难了，如今至少有三千万男同胞是光棍，一个没家庭背景，自己也是普通人，还有顾及自己读书人那点体面，没点能力实在做不到，后来朋友聚会不去了，不是别人看不起自己，而是自己与人不是一个圈子。&lt;/p&gt;&lt;p&gt;

渐渐地自己就只剩下自己了，父母不理解自己，家人觉得你的学历应该这样那样做，可是没人问我难不难，没人与我分析一下从我的实际情况出发。&lt;/p&gt;&lt;p&gt;

有苦说不出，有些人有事一直麻烦人家，所以不愿意说，有些人不想打扰，又怕父母担忧，在成年人的世界里，没有人能一直照顾谁的感受，总觉得别人不容易，越是低谷的时候，越懂得照顾别人的感受，怕因为自己影响别人，一边崩溃一边自愈，有时候晚上被子盖好默默哭完，第二天又继续这无奈的人生，还有生自己的在，还算有一个家，把生自己的送走，自己这辈子也就差不多了。&lt;/p&gt;&lt;p&gt;

至于结不结婚，要看能不能遇见一个愿意和一无所有的自己在一起，至于所谓的爱情，那是有钱人的奢侈品，更何况爱情是两个人的事情，结婚就是两个家庭的事，爱情和婚姻从来都不是一回事，其实有时候怕耽误人家女孩子，这种自卑感油然而生，但是又不屑用手段娶媳妇生孩子，（比如先怀孕再结婚）总觉得喜欢一个人就要尊重她，什么都听她的，这是一个时代的悲哀，也是一个读书人的体面，脸皮又薄，又怕麻烦别人，因为总觉得自己都照顾不好自己，让孩子来这个世界也是受苦受累，走自己的老路，一个男孩子教育不好会毁了自家，一个女孩子教育不好会毁别人家好几代人。之所以大学生混不好的原因是他们习惯理解别人，讲道理、高尚的精神层面，以及为人处世的不争。&lt;/p&gt;&lt;p&gt;

把所有人都当人看。可这个社会生活不讲理，不会理解你、包括女人其实都只是男人争夺的资源而已，也不是所有的人形动物都是人。社会生活是一种规律就像法律一样，不讲人情。残酷的现实把刚出学校的花朵打得支离破碎，把多少成双成对的情侣打得形单影只。&lt;/p&gt;
&lt;/div&gt;

&lt;style&gt;
.info-teacher{
	background-color: #f5f5f5;
	border-radius: 9px;
	border: 1px solid #e5e5e5;
	padding: 6px 6px 16px 10px;
	margin-bottom: 19px;
}
.info-teacher&gt;p{
	
}
&lt;/style&gt;

&lt;div class=&quot;info-teacher&quot;&gt;
&lt;p style=&quot;text-align:center;&quot;&gt;如何当一个快乐的信息老师？&lt;/p&gt;&lt;p&gt;
我当年是不限专业招进来的信息老师，属于招7报2还放弃了1个的那种岗，我就是唯一上岗的那位。进来后先当数学老师，后来各种变动，又教了信息、科技、科学、综实，又教了数学。然后今年学校彻底定下来让我当全职信息老师。但是我已经没有了教信息的热情。
以前我是一门心思当老师，教育情怀、教育热情满满，对学生也充满了爱和耐心。以前有人说不想当老师了或者辞职了，我完全理解不了，当老师这么幸福快乐，怎么会有人想辞职呢？好了，现在我自己体会到了，我感到了当老师的不开心，我也萌生了不想干了的念头。
当信息老师让我的激情都消失了。学生太多了我根本没办法跟任何一个班建立感情，跟学生没有情感链接。&lt;/p&gt;&lt;p&gt;
做一个副课老师，信息课是最难上的课，我真有发言权。而且总是被同事领导默认为上课随便教，反正也不用考试。我明明话费了很多心思去钻研这些课，尤其是如此不符合小学生思维发展水平的《义务教育教学指南》，我天天琢磨怎么上好。这些从不被看见，大家还是默认上信息课就是玩电脑混日子。谁这样想我谁自己就是这种人，哼。成见就是一座山。人家不直接说出来，但是他们的眼神表情告诉你他就是那样想的，默认的无需多言。&lt;/p&gt;&lt;p&gt;
工作量呢，14节课+社团2节+机房管理+副班主任，还不够，还安排去教导处。还不够。年末工作量和工作态度打分上，10个行政总共给了我11分，目测是8人都打1分，2人都打2分。这也极度伤害了我的内心，更打消了我的积极性。&lt;/p&gt;&lt;p&gt;
终于理解了为什么有人当老师要辞职。真的每个人境遇不一样。不想辞职的就是因为你过得还好，还能接受。&lt;/p&gt;&lt;p&gt;
我呢？我是还能忍。今天办公室领导跟我谈他发现国家政策的逐步落地。我心想这不是废话吗，政策当然是一步一步落实的。但这跟我又有什么关系呢？我不过是个连自己都顾不上的信息老师。我只不过是一个累了一天瘫在工位上不想动的小老师。&lt;/p&gt;
&lt;/div&gt;

&lt;hr /&gt;

&lt;p&gt;资深优化师结合专业工程师研发的智能选词系统&lt;/p&gt;

&lt;div class=&quot;item-con&quot;&gt;
	&lt;img src=&quot;https://assets.pgyer.com/static-20210514/images/aso/ai_service1@2x.png&quot; /&gt;
	&lt;div class=&quot;item-content&quot;&gt;蒲公英资深优化师结合多年优化经验，聚合蒲公英大数据，提供最专业的优化方案。&lt;/div&gt;
&lt;/div&gt;

&lt;div class=&quot;item-con&quot;&gt;
	&lt;img src=&quot;https://assets.pgyer.com/static-20210514/images/aso/ai_service2@2x.png&quot; /&gt;
	&lt;div class=&quot;item-content&quot;&gt;深入了解 ASOer 工作流程与优化需求打造的全新 AI 系统，为优化师量身定做，减轻方案撰写负担。&lt;/div&gt;
&lt;/div&gt;

&lt;div class=&quot;item-con&quot;&gt;
	&lt;img src=&quot;https://assets.pgyer.com/static-20210514/images/aso/ai_service3@2x.png&quot; /&gt;
	&lt;div class=&quot;item-content&quot;&gt;资深优化师结合专业工程师研发的智能选词系统，AI 选词+顶级优化师，为您快速选出最完美的方案。&lt;/div&gt;
&lt;/div&gt;

&lt;style&gt;
.item-con{
	height: 80px;
	/* margin-bottom: 10px; */
}
.item-con img{
	position: relative;
    left: -30px;
    top: 8px;
	width: 64px;
    float: left;
}
.item-content {
    background: #FFFFFF;
    border: 1px solid #E1E6F0;
    border-radius: 10px;
    float: left;
    width: 100%;
    padding: 15px 15px 15px 45px;
	margin-top: -70px;
}
&lt;/style&gt;

&lt;p&gt;资深优化师结合专业工程师研发的智能选词系统&lt;/p&gt;

&lt;style&gt;
    .circulars-line{max-width: 558px;border-top: 1px solid rgb(4, 1, 26);height: 1px;}
    .circulars{display: -webkit-flex;margin-top: -15px;}
    .circulars&gt;span{width: 30px;height: 30px;background-color: rgb(4, 1, 26);border-radius: 100%;font-size: 16px;color: rgb(255, 255, 255);line-height: 30px;text-align: center;box-sizing: border-box;}
&lt;/style&gt;

&lt;section class=&quot;circulars-line&quot;&gt;&lt;/section&gt;
&lt;section class=&quot;circulars&quot;&gt;
    &lt;span&gt;推&lt;/span&gt;
    &lt;span&gt;荐&lt;/span&gt;
    &lt;span&gt;阅&lt;/span&gt;
    &lt;span&gt;读&lt;/span&gt;
&lt;/section&gt;

&lt;hr /&gt;

&lt;p style=&quot;border-bottom: 2px solid rgb(255, 177, 27);padding-bottom: 8px;&quot;&gt;
	优化dns查询时间
&lt;/p&gt;

&lt;div class=&quot;comment-list&quot;&gt;
	&lt;ul class=&quot;request-comment-list&quot;&gt;
		&lt;li&gt;
			&lt;img class=&quot;article-comments-item-pic&quot; src=&quot;https://cdn.fe80.cn/uploads/long/mayanbin.jpg&quot; /&gt;
			&lt;div class=&quot;article-comments-item-right&quot;&gt;
				&lt;div class=&quot;article-comments-item-header&quot;&gt;
					&lt;span class=&quot;author&quot;&gt;我&lt;/span&gt; • &lt;time&gt;2019年08月09日 21:42&lt;/time&gt;
				&lt;/div&gt;
				&lt;div class=&quot;article-comments-item-content&quot;&gt;
					&lt;div class=&quot;request-comment&quot;&gt;
						&lt;p&gt;这份工作的工资尤其低，比我上一份还低，但是我却不得不接受。因为这里的工资水平和省会城市确实没法比。虽然一开始不适应，但慢慢的也妥协了。加上和经理还挺聊得来我就选择了这个工资不高但人还不错的公司。&lt;/p&gt;
					&lt;/div&gt;
				&lt;/div&gt;
			&lt;/div&gt;
		&lt;/li&gt;
		&lt;li&gt;
			&lt;img class=&quot;article-comments-item-pic request-comment-user-pic&quot; src=&quot;https://cdn.fe80.cn/uploads/long/mayanbin.jpg&quot; /&gt;
			&lt;div class=&quot;article-comments-item-right&quot;&gt;
				&lt;div class=&quot;article-comments-item-header requst-comment-header&quot;&gt;
					&lt;span class=&quot;author&quot;&gt;我&lt;/span&gt; • &lt;time&gt;2019年08月09日 21:42&lt;/time&gt;
				&lt;/div&gt;
				&lt;div class=&quot;article-comments-item-content request-comment-content&quot;&gt;
					&lt;div class=&quot;request-comment&quot;&gt;
						&lt;p&gt;这份工作是做人资的，也算是专业对口了吧。办公室文职类的一共就3个人，我，行政和出纳。会计是兼职的，一个月就见到一次。其他的都是销售类的，公司主营业务为网络推广。以前我觉得我工资很低，但是当我看到公司架构的时候我才发现原来销售的更低，销售的底薪是600块，要是完不成业绩的话他们就只有600块钱的工资。但是他们都还挺有干劲，这一点我非常佩服，当然也有整体工资水平的原因，在那个城市这个工资一点都不奇怪。&lt;/p&gt;
					&lt;/div&gt;
				&lt;/div&gt;
			&lt;/div&gt;
		&lt;/li&gt;
		&lt;li&gt;
			&lt;img class=&quot;article-comments-item-pic request-comment-user-pic&quot; src=&quot;https://cdn.fe80.cn/uploads/long/mayanbin.jpg&quot; /&gt;
			&lt;div class=&quot;article-comments-item-right&quot;&gt;
				&lt;div class=&quot;article-comments-item-header requst-comment-header&quot;&gt;
					&lt;span class=&quot;author&quot;&gt;我&lt;/span&gt; • &lt;time&gt;2019年08月09日 21:42&lt;/time&gt;
				&lt;/div&gt;
				&lt;div class=&quot;article-comments-item-content request-comment-content&quot;&gt;
					&lt;div class=&quot;request-comment&quot;&gt;
						&lt;p&gt;当我慢慢的接受了那个城市的慢生活节奏和低工资水平的时候，发现这个城市其实也并不是一无是处的。&lt;/p&gt;
					&lt;/div&gt;
				&lt;/div&gt;
			&lt;/div&gt;
		&lt;/li&gt;
		&lt;li&gt;
			&lt;img class=&quot;article-comments-item-pic request-comment-user-pic&quot; src=&quot;https://cdn.fe80.cn/uploads/long/mayanbin.jpg&quot; /&gt;
			&lt;div class=&quot;article-comments-item-right&quot;&gt;
				&lt;div class=&quot;article-comments-item-header requst-comment-header&quot;&gt;
					&lt;span class=&quot;author&quot;&gt;我&lt;/span&gt; • &lt;time&gt;2019年08月09日 21:42&lt;/time&gt;
				&lt;/div&gt;
				&lt;div class=&quot;article-comments-item-content request-comment-content&quot;&gt;
					&lt;div class=&quot;request-comment&quot;&gt;
						&lt;p&gt;剩下的时间可以做其他的事情&lt;/p&gt;
					&lt;/div&gt;
				&lt;/div&gt;
			&lt;/div&gt;
		&lt;/li&gt;
	&lt;/ul&gt;
&lt;/div&gt;

&lt;hr /&gt;

&lt;h4 id=&quot;马云经典语录&quot;&gt;马云经典语录&lt;/h4&gt;

&lt;ul class=&quot;coum&quot;&gt;
	&lt;li&gt;钱是世界上最容易得到的东西&lt;/li&gt;
	&lt;li&gt;我对钱没兴趣，我从来没碰过钱&lt;/li&gt;
	&lt;li&gt;我最后悔的事情就是创建阿里巴巴&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;专家经典语录&quot;&gt;专家经典语录&lt;/h4&gt;

&lt;ul class=&quot;coum&quot;&gt;
	&lt;li&gt;空腹不能吃早餐&lt;/li&gt;
	&lt;li&gt;建议删除朱自清《背影》&lt;/li&gt;
	&lt;li&gt;房价高利于年轻人奋斗&lt;/li&gt;
	&lt;li&gt;呼吁农民不要使用收割机割麦子，会污染环境&lt;/li&gt;
	&lt;li&gt;农业是暴利行业&lt;/li&gt;
	&lt;li&gt;谁家没50万？&lt;/li&gt;
	&lt;li&gt;建议贷款给自己发工资&lt;/li&gt;
	&lt;li&gt;就是现在买不起的时候那就多买几套&lt;/li&gt;
	&lt;li&gt;年轻人在选择工作的时候一定要放弃所谓的享受性高工资的工作&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;影视剧经典语录&quot;&gt;影视剧经典语录&lt;/h4&gt;

&lt;ul class=&quot;coum&quot;&gt;
	&lt;li&gt;我现在没有心情听他们什么`狗屁爱情故事`，我现在就想搞钱。----《插翅难逃》张世豪&lt;/li&gt;
	&lt;li&gt;帮我找到老默，告诉他我想吃鱼了。----《狂飙》高启强&lt;/li&gt;
&lt;/ul&gt;

&lt;style media=&quot;screen&quot;&gt;
	.comment-list ul{

	}
	.comment-list ul li{
		display: block;
		margin-top: 12px;
		min-height: 85px;
		padding-right: 1px;
		border-bottom: 1px dashed #d8b8bf;
	}
	.comment-list ul li img{
		float: left;
		width: 50px;
		height: 50px;
		border-radius: 25px;
		margin-top: 20px;
		margin-right: 20px;
		margin: 12px;
	}
	.article-comments-item-right{
		&lt;!-- padding: 13px; --&gt;
	}
	.request-comment-list{
		padding-left: 2px;
	}
	.article-comments-item-header{
		padding-top: 10px;
		padding-bottom: 5px;
	}
	.article-comments-item-content{
		color: #374051;
		margin-left: 75px;
		margin-bottom: 8px;
		font-size: 16px;
		line-height: 22px;
	}
	.post .author{
		color: #666;
		font-weight: bold;
	}
	.comment-list time{
		margin: 0;
		padding: 0;
		border: 0;
		font-size: 100%;
		font-weight: 400;
		vertical-align: baseline;
		background: 0 0;
		word-break: break-word;
		color: #919199;
	}
	/* li排序序号 */
	.coum{
		counter-reset: ili;
	}
	.coum li{
		list-style: none;
	}
	.coum li:before {
		/* width: 30px;
		height: 30px;
		font-size: 14px; */
		margin: 0 6px 0 0;
		padding: 2px 7px;
		content: counter(ili);
		counter-increment: ili;
		/* position: absolute; */
		/* left: 0; */
		color: #ffffff;
		font-weight: 600;
		/* text-align: center; */
		border-radius: 100%;
		background-color: #3CB371;
	}
&lt;/style&gt;

&lt;h6 id=&quot;小结&quot;&gt;小结&lt;/h6&gt;

&lt;p&gt;博客样式是非常灵活的。&lt;/p&gt;

&lt;p&gt;&lt;em&gt;这里是文字&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;这里是文字&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;重点任务&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;这里是文字&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;del&gt;以下是实际的markdown&lt;/del&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;*这里是文字*

_这里是文字_

**重点任务**

***这里是文字***

~~以下是实际的markdown~~
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;style&gt;
.card {
    position: relative;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #fff;
    background-clip: border-box;
    border: 1px solid rgba(0, 0, 0, .125);
    border-radius: 0.25rem;
}
.border-info {
    border-color: #17a2b8 !important;
}
.bg-info {
    background-color: #17a2b8 !important;
}
.text-white {
    color: #fff !important;
}
.card-header,.card-body{
	padding: 6px;
}
&lt;/style&gt;

&lt;div class=&quot;card border-info mb-3&quot;&gt;
	&lt;div class=&quot;card-header bg-info text-white&quot;&gt;Kms 激活&lt;/div&gt;
	&lt;div class=&quot;card-body&quot;&gt;
		&lt;p&gt;以默认安装 Office 2019 为例&lt;br /&gt;
		Win+R 运行 CMD，cd 到指定目录，调用 ospp.vbs 激活即可&lt;/p&gt;
		&lt;p&gt;64 位 Office 路径 cd C:\Program Files\Microsoft Office\Office16&lt;br /&gt;
		32 位 Office 路径 cd C:\Program Files (x86)\Microsoft Office\Office16&lt;/p&gt;
		&lt;p&gt;cd C:\Program Files (x86)\Microsoft Office\Office16&lt;br /&gt;
		cscript ospp.vbs /sethst:kms.vv1234.cn&lt;br /&gt;
		cscript ospp.vbs /act&lt;br /&gt;
		cscript ospp.vbs /dstatus&lt;/p&gt;
	&lt;/div&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Nginx技术指北</title>
   <link href="https://comeround.cn/article/nginx-turn-to-north.html"/>
   <updated>2020-07-31T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/nginx-turn-to-north</id>
   <content type="html">&lt;p&gt;学计算机的同学都知道，TCP/IP协议簇中的HTTP就是访问网站使用的协议，Nginx就是HTTP的服务器。&lt;/p&gt;

&lt;h2 id=&quot;一重定向&quot;&gt;一、重定向&lt;/h2&gt;

&lt;h4 id=&quot;域名重定向&quot;&gt;域名重定向&lt;/h4&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$host&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;!^www.)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;301&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://www.替换你的域名.com&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request_uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;状态码重定向&quot;&gt;状态码重定向&lt;/h4&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;error_page&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;404&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://www.替换你的域名.com&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request_uri&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#响应302状态码&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;二ua防盗链&quot;&gt;二、UA防盗链&lt;/h2&gt;
&lt;blockquote&gt;
  &lt;p&gt;对于个人或小型网站来说，我不希望国外蜘蛛来访问我的网站，特别是个别垃圾蜘蛛，它们访问特别频繁。这些垃圾流量多了之后，严重浪费服务器的带宽和资源。通过判断user agent，在nginx中禁用这些蜘蛛可以节省一些流量，也可以防止一些恶意的访问。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$http_user_agent&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;(Scrapy|Curl|HttpClient|Hacker|Creaker))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;403&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;三referer防盗链&quot;&gt;三、Referer防盗链&lt;/h2&gt;
&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;背景说明&lt;/strong&gt;：为了避免他人获取服务器资源，只能让本服务器能正常访问服务器资源，使用refer做防止其他网站或直接获取服务器资源，在nginx中配置如下：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/uploads/mail/201&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;valid_referers&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;blocked&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;www.pinlucky.com&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;www.pinlucky.cn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#valid_referers blocked $server_name;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$invalid_referer&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;rewrite&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;^/&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/static/img/openRedBG.png&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;403&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#rewrite ^/ /static/img/openRedBG.png;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;四设置过期时间&quot;&gt;四、设置过期时间&lt;/h2&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;.*\.(gif|jpg|jpeg|png|bmp|swf)\$&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;expires&lt;/span&gt;      &lt;span class=&quot;s&quot;&gt;30d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;生成头部为&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Accept-Ranges: bytes
Cache-Control: max-age=2592000
Content-Length: 1428235
Content-Type: image/jpeg
Date: Fri, 04 Jun 2021 08:11:58 GMT
ETag: &quot;60b9e02f-15cb0b&quot;
Expires: Sun, 04 Jul 2021 08:11:58 GMT
Last-Modified: Fri, 04 Jun 2021 08:11:27 GMT
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;五ip黑白名单&quot;&gt;五、IP黑(白)名单&lt;/h2&gt;

&lt;h3 id=&quot;ip白名单&quot;&gt;IP白名单&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;allow 1.1.1.1; 
allow 1.1.1.2;
deny 1.1.2.0/24;
deny all;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;ip黑名单&quot;&gt;IP黑名单&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;deny 1.1.1.2;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;六限速管理&quot;&gt;六、限速管理&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;limit_conn perip 5;
limit_rate_after 500k;
limit_rate 20k;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;上面这两个limit的意思是：单个IP最大允许5个连接，单个连接带宽为20K，若下载器一次可以发起5个请求（5个连接数），那么这个下载器最大下载速度为100K;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;七防攻击&quot;&gt;七、防攻击&lt;/h2&gt;

&lt;h3 id=&quot;cc防攻击&quot;&gt;CC防攻击&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;https://www.centos.bz/2012/12/openresty-nginx-block-cc-attack-deploy/&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;异常攻击&quot;&gt;异常攻击&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;185.153.197.165 - - [01/Aug/2021:06:38:08 +0800] &quot;\x03\x00\x00/*\xE0\x00\x00\x00\x00\x00Cookie: mstshash=Administr&quot; 400 150 &quot;-&quot; &quot;-&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;解决办法&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;add_header Allow &quot;GET, POST, HEAD, DELETE, OPTIONS&quot; always; 
if ($request_method !~ ^(GET|POST|HEAD|OPTIONS|DELETE|PUT)$) { 
    return 405; 
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;屏蔽异常ip&quot;&gt;屏蔽异常IP&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cat *.log |grep &apos;\&quot;\\x&apos; |awk &apos;{print &quot;deny&quot;,$1&quot;;&quot;}&apos;|sort|uniq &amp;gt; /usr/local/nginx/conf/block.conf
# 在Nginx中引入
include block*.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;八url重写&quot;&gt;八、URL重写&lt;/h2&gt;

&lt;h3 id=&quot;普通重写&quot;&gt;普通重写&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rewrite  ^(.*)$  /index.php?s=$1  last;&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;php后缀改为html后缀未测试&quot;&gt;PHP后缀改为html后缀（未测试）&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rewrite  ^(.*)\.php(.*)$  /$1\.html$2  last;&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;忽略html扩展名&quot;&gt;忽略html扩展名&lt;/h3&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;try_files&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$uri&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.html&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$uri&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$uri&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;404&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;九过滤请求&quot;&gt;九、过滤请求&lt;/h2&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request_method&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;GET|get)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;rewrite&lt;/span&gt;  &lt;span class=&quot;s&quot;&gt;^(.*)&lt;/span&gt;$  &lt;span class=&quot;n&quot;&gt;/notice&lt;/span&gt;  &lt;span class=&quot;s&quot;&gt;last&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;十反向代理&quot;&gt;十、反向代理&lt;/h2&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;upstream&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;tornado&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;127.0.0.1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5010&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;server&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;tornado.com&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;proxy_pass&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;http://tornado&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;root&lt;/span&gt;   &lt;span class=&quot;s&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;access_log&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;/home/wwwlogs/tornado.log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;十一代理websocket&quot;&gt;十一、代理Websocket&lt;/h2&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/websocket&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;proxy_pass&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;http://127.0.0.1:9501&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;X-Real-IP&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$remote_addr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;proxy_read_timeout&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;600&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Host&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;X-Forwarded-For&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$proxy_add_x_forwarded_for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;proxy_http_version&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Upgrade&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$http_upgrade&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Connection&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;upgrade&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;Websocket地址：ws://www.web.com/websocket&lt;/li&gt;
  &lt;li&gt;如果是https协议，就是 wss://www.web.com/websocket&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;十二头部操作&quot;&gt;十二、头部操作&lt;/h2&gt;

&lt;h3 id=&quot;添加响应头部&quot;&gt;添加响应头部&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;这样在浏览器的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Response Headers&lt;/code&gt;就能看到客户端的IP了，注意放到location里面，还可能被其他location覆盖导致获取不到。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;add_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;yourip&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$remote_addr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;添加请求头代理时&quot;&gt;添加请求头（代理时）：&lt;/h3&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/proxypass&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Host&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;X-Forwarded-For&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$proxy_add_x_forwarded_for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;获取自定义头部&quot;&gt;获取自定义头部&lt;/h3&gt;

&lt;p&gt;比如我们自定义header为X-Real-IP,通过nginx获取该header时需要这样:$http_x_real_ip; (一律采用小写，而且前面多了个http_)&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl http://127.0.0.1/nginx -H &quot;A-B-C:a-B-c&quot; -v
127.0.0.1 - a-B-c
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/nginx&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;default_type&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;text/html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$remote_addr&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$http_a_b_c&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$http_a_b_c&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;abcdef00&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;403&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;访问被禁止，访问该请求需要特定的头部&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;十三使用nginx作文件服务&quot;&gt;十三、使用Nginx作文件服务&lt;/h2&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/dir&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;charset&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;utf-8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;autoindex&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;autoindex_localtime&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;autoindex_exact_size&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;add_after_body&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/autoindex.html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;其中&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;add_after_body /autoindex.html&lt;/code&gt;可自定义加在html后面的内容，设置自定义样式，页面优化可访问 https://phus.lu/&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/nginx-file-server.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;十四泛域名泛网站&quot;&gt;十四、泛域名+泛网站&lt;/h2&gt;

&lt;p&gt;类似于&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Git Pages&lt;/code&gt;网站，将该域名的所有子域名解析到同一个IP，每个子域名访问到自己的目录上。即&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a.gitee.io&lt;/code&gt;访问到目录&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;./a.gitee.io/&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;b.gitee.io&lt;/code&gt;访问到目录&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;./b.gitee.io/&lt;/code&gt;。&lt;/p&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;*.gitee.io&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;root&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;D:/Pro/phpEnv/www/&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;error_page&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;404&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/404.html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;access_log&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;logs/gitee&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.io.access.log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;error_log&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;logs/gitee&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.io.error.log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;十五日志记录&quot;&gt;十五、日志记录&lt;/h2&gt;

&lt;p&gt;日志自定义格式配置&lt;/p&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;http&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;log_format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;main_json&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;kn&quot;&gt;&quot;@timestamp&quot;:&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$time_local&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;,&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;&quot;client_ip&quot;:&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$remote_addr&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;,&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;&quot;request&quot;:&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;,&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;&quot;status&quot;:&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$status&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;,&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;&quot;bytes&quot;:&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$body_bytes_sent&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;,&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;&quot;x_forwarded&quot;:&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$http_x_forwarded_for&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;,&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;&quot;referer&quot;:&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$http_referer&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;log_format&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;simple&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$remote_addr&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$remote_user&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;access_log&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;logs/access&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;_json.log&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;main_json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;log_format格式变量：
    $remote_addr  #记录访问网站的客户端地址
    $remote_user  #远程客户端用户名
    $time_local  #记录访问时间与时区
    $request  #用户的http请求起始行信息
    $status  #http状态码，记录请求返回的状态码，例如：200、301、404等
    $body_bytes_sent  #服务器发送给客户端的响应body字节数
    $http_referer  #记录此次请求是从哪个连接访问过来的，可以根据该参数进行防盗链设置。
    $http_user_agent  #记录客户端访问信息，例如：浏览器、手机客户端等
    $http_x_forwarded_for  #当前端有代理服务器时，设置web节点记录客户端地址的配置，此参数生效的前提是代理服务器也要进行相关的x_forwarded_for设置
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;十六日志切割&quot;&gt;十六、日志切割&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;配置文件 vim /etc/logrotate.d/nginx&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;/home/wwwlogs/*.log&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;su&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;root&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;root&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;daily&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;dateext&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;compress&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;rotate&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;notifempty&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;sharedscripts&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;postrotate&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;kill&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;-USR1&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;`cat&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/usr/local/nginx/logs/nginx.pid`&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;endscript&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;十七nginx日志分析&quot;&gt;十七、Nginx日志分析&lt;/h2&gt;

&lt;h3 id=&quot;都用哪些安卓版本&quot;&gt;都用哪些安卓版本&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cat ssl_xinxi.club.log|awk -F &apos;&quot;&apos; &apos;{print $6}&apos;|egrep -o &quot;Android [0-9.]+;&quot;|sort|uniq -c&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1 Android 4.0.4;
1 Android 4.4.2;
7 Android 4.4.4;
7 Android 5.0.2;
12 Android 5.1;
24 Android 5.1.1;
18 Android 6.0;
20 Android 6.0.1;
6 Android 7.0;
30 Android 7.1.1;
87 Android 7.1.2;
63 Android 8.0;
79 Android 8.1;
2 Android 8.1.0;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;500状态码url统计&quot;&gt;500状态码URL统计&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cat *.log|grep &quot; 500 &quot;|awk &apos;{print $7}&apos;|sort|uniq -c |sort -nr&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;14 /admin/Sports/event_list.html
5 /rest/yard/index
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;404状态码的ip统计&quot;&gt;404状态码的IP统计&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cat *.log|grep &quot; 404 &quot;|awk &apos;{print $1}&apos;|sort|uniq -c |sort -nr|head&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;十八带宽限制&quot;&gt;十八、带宽限制&lt;/h2&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/download&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;limit_rate&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;limit_rate_after&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;500k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#limit_rate_after 512; 发送头部之后立即限制&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;#limit_conn   limitconnbyaddr  1; 限制1个IP只能有1个连接&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;十九更改响应状态码&quot;&gt;十九、更改响应状态码&lt;/h2&gt;

&lt;h3 id=&quot;允许post请求json文件&quot;&gt;允许POST请求json文件&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;location ~ (.*\.json)
{
    error_page 405 =200 $1;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Elasticsearch笔记</title>
   <link href="https://comeround.cn/article/elasticsearch-note.html"/>
   <updated>2020-07-29T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/elasticsearch-note</id>
   <content type="html">&lt;h2 id=&quot;一安装&quot;&gt;一、安装&lt;/h2&gt;

&lt;p&gt;文件源：https://mirrors.tuna.tsinghua.edu.cn/elasticstack/7.x/yum/&lt;/p&gt;

&lt;p&gt;wget https://mirrors.tuna.tsinghua.edu.cn/elasticstack/7.x/yum/7.8.1/elasticsearch-7.8.1-x86_64.rpm&lt;/p&gt;

&lt;p&gt;rpm -ivh elasticsearch-7.8.1-x86_64.rpm&lt;/p&gt;

&lt;p&gt;编辑：/etc/elasticsearch/elasticsearch.yml&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# cat /etc/elasticsearch/elasticsearch.yml|grep -v &quot;^#&quot;
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: [&quot;0.0.0.0&quot;, &quot;::&quot;]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;service elasticsearch.service restart&lt;/p&gt;

&lt;h2 id=&quot;二基本使用&quot;&gt;二、基本使用&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@baihua ~]# curl http://39.104.117.27:9200/
{
    &quot;name&quot;:&quot;temp802&quot;,
    &quot;cluster_name&quot;:&quot;elasticsearch&quot;,
    &quot;cluster_uuid&quot;:&quot;GpWqqxKfSIOnmzbtmuMnvA&quot;,
    &quot;version&quot;:{
        &quot;number&quot;:&quot;7.8.1&quot;,
        &quot;build_flavor&quot;:&quot;default&quot;,
        &quot;build_type&quot;:&quot;rpm&quot;,
        &quot;build_hash&quot;:&quot;b5ca9c58fb664ca8bf9e4057fc229b3396bf3a89&quot;,
        &quot;build_date&quot;:&quot;2020-07-21T16:40:44.668009Z&quot;,
        &quot;build_snapshot&quot;:false,
        &quot;lucene_version&quot;:&quot;8.5.1&quot;,
        &quot;minimum_wire_compatibility_version&quot;:&quot;6.8.0&quot;,
        &quot;minimum_index_compatibility_version&quot;:&quot;6.0.0-beta1&quot;
    },
    &quot;tagline&quot;:&quot;You Know, for Search&quot;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;写入数据&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;POST http://39.104.117.27:9200/home/index&lt;/p&gt;
&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;李四&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;查询数据&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;GET http://39.104.117.27:9200/home/index/_search&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;query&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;match&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;took&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;381&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;timed_out&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;_shards&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;total&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;successful&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;skipped&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;failed&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hits&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;total&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;value&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;relation&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;eq&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;max_score&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;1.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hits&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;_index&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;home&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;_type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;index&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;_id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;o4VHmnMBfIxNROFX3s7B&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;_score&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;1.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;_source&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;张三&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;查看有哪些库&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;GET http://39.104.117.27:9200/_cat/indices?v&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;删除数据库&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;DELETE http://39.104.117.27:9200/home&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;acknowledged&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;三汇聚查询&quot;&gt;三、汇聚查询&lt;/h2&gt;

&lt;h4 id=&quot;1where查询&quot;&gt;（1）WHERE查询&lt;/h4&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{&quot;query&quot;:{&quot;match&quot;:{&quot;yid&quot;:&quot;yid\_5cf367e9ac0b3&quot;}}}&lt;/code&gt;&lt;/p&gt;

&lt;h4 id=&quot;2范围查询&quot;&gt;（2）范围查询&lt;/h4&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{&quot;query&quot;:{&quot;range&quot;:{&quot;stop&quot;:{&quot;gte&quot;:7,&quot;lte&quot;:10}}}}&lt;/code&gt;&lt;/p&gt;

&lt;h4 id=&quot;3计算总和&quot;&gt;（3）计算总和&lt;/h4&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{&quot;aggs&quot;:{&quot;sum\_stop&quot;:{&quot;sum&quot;:{&quot;field&quot;:&quot;stop&quot;}}}}&lt;/code&gt;&lt;/p&gt;

&lt;h4 id=&quot;4数据分组&quot;&gt;（4）数据分组&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;针对int类型&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{&quot;size&quot;:0,&quot;aggs&quot;:{&quot;all\_stop&quot;:{&quot;terms&quot;:{&quot;field&quot;:&quot;stop&quot;}}}}&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;String类型&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{&quot;size&quot;:0,&quot;aggs&quot;:{&quot;yids&quot;:{&quot;terms&quot;:{&quot;field&quot;:&quot;yid.keyword&quot;,&quot;size&quot;:10}}}}&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;双组查询&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{&quot;size&quot;:0,&quot;aggs&quot;:{&quot;urls&quot;:{&quot;terms&quot;:{&quot;field&quot;:&quot;url.keyword&quot;},&quot;aggs&quot;:{&quot;yids&quot;:{&quot;terms&quot;:{&quot;field&quot;:&quot;yid.keyword&quot;,&quot;size&quot;:1}}}}}}&lt;/code&gt;&lt;/p&gt;

&lt;h4 id=&quot;5数据计数&quot;&gt;（5）数据计数&lt;/h4&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;es.yongdongli.net:9100/home/index/\_count&lt;/code&gt;&lt;/p&gt;

&lt;h4 id=&quot;6正则查询某个字段&quot;&gt;（6）正则查询某个字段&lt;/h4&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{&quot;size&quot;:20,&quot;query&quot;:{&quot;regexp&quot;:{&quot;url&quot;:&quot;find(.\*)&quot;}}}&lt;/code&gt;&lt;/p&gt;

&lt;h4 id=&quot;7查询某个字段总和&quot;&gt;（7）查询某个字段总和&lt;/h4&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{&quot;size&quot;:0,&quot;aggs&quot;:{&quot;sum\_stop&quot;:{&quot;sum&quot;:{&quot;field&quot;:&quot;stop&quot;}}}}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;{&quot;size&quot;:0,&quot;aggs&quot;:{&quot;sum\_stop&quot;:{&quot;terms&quot;:{&quot;field&quot;:&quot;url.keyword&quot;,&quot;size&quot;:60}}}}&lt;/code&gt;&lt;/p&gt;

&lt;h4 id=&quot;8时间分组按小时&quot;&gt;（8）时间分组按小时&lt;/h4&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;size&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;aggs&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;group_by_create_time&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;date_histogram&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;field&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;create_time&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;interval&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1h&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;format&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;yyyy-MM-dd HH&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;min_doc_count&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;extended_bounds&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;min&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1588000000000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;max&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1588134534000&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;query&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;bool&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;must&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;range&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;create_time&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;gte&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1588000000000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;lte&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1588134534000&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;9去重计数&quot;&gt;（9）去重计数&lt;/h4&gt;
&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;size&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;aggs&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;all_stop&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;cardinality&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;field&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;yid.keyword&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;10综合匹配&quot;&gt;（10）综合匹配&lt;/h4&gt;

&lt;p&gt;根据某个字段倒序，某个字段匹配正则，某个字段为空时查询，去重yid字段&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;size&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;query&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;bool&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;must&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;regexp&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;url&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;find(.*)&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;must_not&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;term&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;yid&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;collapse&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;field&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;yid.keyword&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;sort&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;create_time&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;order&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;desc&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;四项目使用&quot;&gt;四、项目使用&lt;/h2&gt;

&lt;p&gt;PHP项目composer安装插件&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;composer require elasticsearch/elasticsearch
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;五总结&quot;&gt;五、总结&lt;/h2&gt;

&lt;p&gt;暂无总结&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Flask应用指南</title>
   <link href="https://comeround.cn/article/flask-to-site.html"/>
   <updated>2020-06-10T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/flask-to-site</id>
   <content type="html">&lt;h2 id=&quot;一入门程序&quot;&gt;一、入门程序&lt;/h2&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;#encoding: utf-8
&lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;flask&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Flask&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;render_template&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Flask&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;__name__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 首页
&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;@app.route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;page1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# 注意这里使用了 render_template 函数，
&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# 它会从 templates 文件夹中寻找对应的 HTML 文件
&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;render_template&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;page1.html&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__name__&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;__main__&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;debug&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;0.0.0.0&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;二环境配置&quot;&gt;二、环境配置&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;依赖安装&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pip3 install flask&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pip3 install sqlalchemy&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pip3 install mysql-connector&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
  &lt;p&gt;开发模式&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;python app.py&lt;/code&gt;或&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flask run&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;三代码入门&quot;&gt;三、代码入门&lt;/h2&gt;

&lt;p&gt;（1）返回json接口&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;return jsonify(array)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;（2）自定义响应头&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@app.route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/json&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sysinfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;alist&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;alist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;xxx&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;resp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;make_response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;jsonify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;alist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;resp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Access-Control-Allow-Origin&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;resp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Content-Type&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;application/json; charset=utf-8&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;resp&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（3）接收参数，get获取url&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;@app.route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/user/&amp;lt;username&amp;gt;&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;username&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;username&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（4）MySQL查询&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sqlalchemy&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Column&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;create_engine&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sqlalchemy.orm&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sessionmaker&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sqlalchemy.ext.declarative&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;declarative_base&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sqlalchemy&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;create_engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Column&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MetaData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ForeignKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;select&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Date&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;DB_URL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;mysql+mysqlconnector://{}:{}@{}:{}/{}?charset=utf8&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;USERNAME&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;PASSWORD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HOST&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;PORT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DATABASE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;create_engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DB_URL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;DBSession&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sessionmaker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;session&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;DBSession&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;alist&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;session&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;SELECT * FROM b_admin WHERE `state` = 1&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;admins&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;admin&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{}&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;admin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;account&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;account&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;admin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;realname&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;realname&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;admin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;role&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;role&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;admins&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;admin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;admins&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（5）异步任务 20220920&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;concurrent.futures&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ThreadPoolExecutor&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;executor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ThreadPoolExecutor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# 模拟耗时任务
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;run_job&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;run_job complete&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;flush&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;nd&quot;&gt;@app.route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/run&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;run_async&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;this is a async&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;executor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;submit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;run_job&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;return now.&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;flush&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;ret&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;ok&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（6）404页面设置&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# 自定义 404 错误页面
&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;@app.errorhandler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;404&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;page_not_found&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# 注意这里使用了 render_template 函数，
&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# 它会从 templates 文件夹中寻找对应的 HTML 文件
&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;render_template&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;404.html&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;404&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（6）socket.io写websocket&lt;/p&gt;

&lt;p&gt;（7）定时任务-心跳程序&lt;/p&gt;

&lt;h2 id=&quot;四部署上线&quot;&gt;四、部署上线&lt;/h2&gt;

&lt;h4 id=&quot;gunicorn方式部署&quot;&gt;gunicorn方式部署：&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;安装gunicorn &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pip3 install gunicorn&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;运行gunicorn &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gunicorn -w 4 -b 0.0.0.0:8000 -D app:app&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;启动与关闭&quot;&gt;启动与关闭&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;关闭进程：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;killall gunicorn&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;启动进程：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gunicorn -w 4 -b 0.0.0.0:8000 -D app:app&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;supervisor守护进程&quot;&gt;supervisor守护进程&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;安装 yum install supervisor -y&lt;/li&gt;
  &lt;li&gt;配置 /etc/supervisor.d/gunicorn.conf&lt;/li&gt;
  &lt;li&gt;启动 supervisor -c /etc/supervisor.conf&lt;/li&gt;
  &lt;li&gt;重启 supervisorctl restart gunicorn&lt;/li&gt;
  &lt;li&gt;重新加载配置 supervisorctl reload&lt;/li&gt;
  &lt;li&gt;查看项目状态 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;supervisorctl status&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;停止项目 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;supervisorctl stop xxx&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;gunicorn.conf配置文件&lt;/p&gt;

&lt;div class=&quot;language-conf highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[&lt;span class=&quot;n&quot;&gt;program&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;gunicorn&lt;/span&gt;]
&lt;span class=&quot;n&quot;&gt;directory&lt;/span&gt;=/&lt;span class=&quot;n&quot;&gt;home&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;flaskapp&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;command&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;gunicorn&lt;/span&gt; -&lt;span class=&quot;n&quot;&gt;w&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4&lt;/span&gt; -&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; :&lt;span class=&quot;m&quot;&gt;5000&lt;/span&gt; --&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;level&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;warning&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;flaskweb&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;app&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;root&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;autostart&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;autorestart&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;loglevel&lt;/span&gt;=&lt;span class=&quot;n&quot;&gt;info&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;stdout_logfile&lt;/span&gt;=/&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;gunicorn&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;stdout&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;stderr_logfile&lt;/span&gt;=/&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;/&lt;span class=&quot;n&quot;&gt;gunicorn&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;stderr&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;log&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;使用阿里云函数计算serverless部署&quot;&gt;使用阿里云函数计算（ServerLess）部署&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://help.aliyun.com/zh/functioncompute/use-cases/deploy-stable-diffusion-based-on-function-compute-to-achieve-higher-quality-in-image-generation&quot;&gt;部署&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote class=&quot;success&quot;&gt;
  &lt;p&gt;创建应用&amp;gt;Web框架&amp;gt;Flask&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;五总结&quot;&gt;五、总结&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;Flask部署方式主要有&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;uWSGI&lt;/code&gt;和&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Gunicorn&lt;/code&gt;，推荐使用后者&lt;/li&gt;
&lt;/ol&gt;
</content>
 </entry>
 
 <entry>
   <title>bash脚本安装MySQL-8.0.20数据库</title>
   <link href="https://comeround.cn/article/mysql-8020-bash.html"/>
   <updated>2020-04-30T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/mysql-8020-bash</id>
   <content type="html">&lt;h2 id=&quot;一基础环境检测创建文件夹与下载数据库安装包&quot;&gt;一、基础环境检测创建文件夹与下载数据库安装包&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;环境：
    &lt;ul&gt;
      &lt;li&gt;阿里云ECS CentOS8.1&lt;/li&gt;
      &lt;li&gt;MySQL8.0.20-el8版本&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;检测存放安装包的目录是否存在&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/root/mysql&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;then
    &lt;/span&gt;Echo_Blue &lt;span class=&quot;s1&quot;&gt;&apos;[info] 创建文件夹：/root/mysql&apos;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;mkdir&lt;/span&gt; /root/mysql
&lt;span class=&quot;k&quot;&gt;else
    &lt;/span&gt;Echo_Yellow &lt;span class=&quot;s2&quot;&gt;&quot;[info] 文件夹/root/mysql已经存在，继续执行...&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;fi
&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /root/mysql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;检测安装包是否已经下载&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/root/mysql/mysql-8.0.20-1.el8.x86_64.rpm-bundle.tar&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;then
    &lt;/span&gt;Echo_Blue &lt;span class=&quot;s1&quot;&gt;&apos;[info] Mysql包不存在，正在下载&apos;&lt;/span&gt;
    wget https://mirrors.huaweicloud.com/mysql/Downloads/MySQL-8.0/mysql-8.0.20-1.el8.x86_64.rpm-bundle.tar
&lt;span class=&quot;k&quot;&gt;else
    &lt;/span&gt;Echo_Blue &lt;span class=&quot;s2&quot;&gt;&quot;[info] Mysql包已存在，继续执行...&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;二解压数据库安装包&quot;&gt;二、解压数据库安装包&lt;/h2&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tar -xvf mysql-8.0.20-1.el8.x86_64.rpm-bundle.tar&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;三判断是否解压完成并安装&quot;&gt;三、判断是否解压完成，并安装&lt;/h2&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;mysql-community-common-8.0.20-1.el8.x86_64.rpm&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;then
    &lt;/span&gt;Echo_Red &lt;span class=&quot;s1&quot;&gt;&apos;[error] 解压失败，请检查&apos;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;exit
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else
    &lt;/span&gt;Echo_Green &lt;span class=&quot;s2&quot;&gt;&quot;[info] MySQL安装中，继续执行...&quot;&lt;/span&gt;
    rpm &lt;span class=&quot;nt&quot;&gt;-ivh&lt;/span&gt; mysql-community-common-8.0.20-1.el8.x86_64.rpm &lt;span class=&quot;nt&quot;&gt;--nodeps&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--force&lt;/span&gt;
    rpm &lt;span class=&quot;nt&quot;&gt;-ivh&lt;/span&gt; mysql-community-libs-8.0.20-1.el8.x86_64.rpm &lt;span class=&quot;nt&quot;&gt;--nodeps&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--force&lt;/span&gt;
    rpm &lt;span class=&quot;nt&quot;&gt;-ivh&lt;/span&gt; mysql-community-client-8.0.20-1.el8.x86_64.rpm &lt;span class=&quot;nt&quot;&gt;--nodeps&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--force&lt;/span&gt;
    rpm &lt;span class=&quot;nt&quot;&gt;-ivh&lt;/span&gt; mysql-community-server-8.0.20-1.el8.x86_64.rpm &lt;span class=&quot;nt&quot;&gt;--nodeps&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--force&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;四修改mycnf配置文件&quot;&gt;四、修改my.cnf配置文件&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;修改密码验证方式（根据需要设置）&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;default_authentication_plugin=mysql_native_password&quot;&lt;/span&gt; /etc/my.cnf&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-eq&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;0&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
    &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;s/\[mysqld\]/\[mysqld\]\ndefault_authentication_plugin=mysql_native_password/&apos;&lt;/span&gt; /etc/my.cnf
    Echo_Blue &lt;span class=&quot;s2&quot;&gt;&quot;[info] 配置default_authentication_plugin=mysql_native_password&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;else
    &lt;/span&gt;Echo_Yellow &lt;span class=&quot;s2&quot;&gt;&quot;[info] /etc/my.cnf已存在default_authentication_plugin=mysql_native_password&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;修改sql_mode，建议设置&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;sql_mode&quot;&lt;/span&gt; /etc/my.cnf&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-eq&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;0&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
    &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;s/\[mysqld\]/\[mysqld\]\nsql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES/&apos;&lt;/span&gt; /etc/my.cnf
    Echo_Green &lt;span class=&quot;s2&quot;&gt;&quot;[info] 配置sql_mode完成&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;else
    &lt;/span&gt;Echo_Blue &lt;span class=&quot;s2&quot;&gt;&quot;[info] /etc/my.cnf已存在sql_mode&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;五初始化配置并修改密码&quot;&gt;五、初始化配置并修改密码&lt;/h2&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysqld &lt;span class=&quot;nt&quot;&gt;--initialize&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;mysql&quot;&lt;/span&gt; /etc/group&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-eq&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;0&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
    &lt;/span&gt;Echo_Yellow &lt;span class=&quot;s2&quot;&gt;&quot;[info] 不存在mysql用户，正在添加&quot;&lt;/span&gt;
    groupadd mysql
    useradd &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; /sbin/nologin &lt;span class=&quot;nt&quot;&gt;-M&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; mysql mysql
&lt;span class=&quot;k&quot;&gt;else
    &lt;/span&gt;Echo_Yellow &lt;span class=&quot;s2&quot;&gt;&quot;[info] 授予mysql用户权限&quot;&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;mysql:mysql /var/lib/mysql &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/var/log/mysqld.log&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;then
        &lt;/span&gt;Echo_Red &lt;span class=&quot;s2&quot;&gt;&quot;[error] /var/log/mysqld.log文件不存在，请检查。&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else
        &lt;/span&gt;Echo_Green &lt;span class=&quot;s2&quot;&gt;&quot;[info] 原始密码：&quot;&lt;/span&gt;
        &lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /var/log/mysqld.log|grep &lt;span class=&quot;s2&quot;&gt;&quot;A temporary password is generated for root@localhost:&quot;&lt;/span&gt; |awk &lt;span class=&quot;nt&quot;&gt;-F&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;host:&quot;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;{print $2}&apos;&lt;/span&gt;
        Echo_Yellow &lt;span class=&quot;s2&quot;&gt;&quot;[info] 请先修改密码mysql_secure_installation&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;fi
    &lt;/span&gt;Echo_Green &lt;span class=&quot;s2&quot;&gt;&quot;[info] 安装完成。&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;设置新密码，输入原始密码并输入新密码&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysql_secure_installation
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;重启mysql&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;systemctl start mysqld.service
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;六执行脚本自动安装&quot;&gt;六、执行脚本自动安装&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wget http://hello.fe80.cn/bash/mysql8020el8.sh &amp;amp;&amp;amp; bash mysql8020el8.sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>SVN提交与自动部署</title>
   <link href="https://comeround.cn/article/svn-commit-deploy.html"/>
   <updated>2020-03-30T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/svn-commit-deploy</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;代码自动更新，解放你的双手&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;一svn简介&quot;&gt;（一）SVN简介&lt;/h3&gt;

&lt;p&gt;Subversion(SVN) 是一个开源的版本控制系統。&lt;/p&gt;

&lt;h3 id=&quot;二svn安装&quot;&gt;（二）SVN安装&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;安装&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;yum install subversion -y
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;创建仓库&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir /home/svn &amp;amp;&amp;amp; svnadmin create /home/svn
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;SVN配置文件&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;authz 是权限控制文件
passwd 是帐号密码文件
svnserve.conf 是SVN服务配置文件
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;启动SVN服务&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;svnserve -d -r /home/svn
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;三svn命令&quot;&gt;（三）SVN命令&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;add
blame (praise, annotate, ann)
cat
changelist (cl)
checkout (co)
cleanup
commit (ci)
copy (cp)
delete (del, remove, rm)
diff (di)
export
help (?, h)
import
info
list (ls)
lock
log
merge
mergeinfo
mkdir
move (mv, rename, ren)
patch
propdel (pdel, pd)
propedit (pedit, pe)
propget (pget, pg)
proplist (plist, pl)
propset (pset, ps)
relocate
resolve
resolved
revert
status (stat, st)
switch (sw)
unlock
update (up)
upgrade
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;检出&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;svn co #等同于svn checkout
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;更新代码&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;svn up #等同于svn update
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;提交代码&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;svn commit -m &apos;xxxx&apos;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;四svn钩子&quot;&gt;（四）SVN钩子&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;钩子类型&lt;/li&gt;
&lt;/ul&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;钩子名称&lt;/th&gt;
      &lt;th&gt;钩子作用&lt;/th&gt;
      &lt;th&gt;作用&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;post-commit&lt;/td&gt;
      &lt;td&gt;提交之后触发&lt;/td&gt;
      &lt;td&gt;提交成功之后执行某操作，如自动更新&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;pre-commit&lt;/td&gt;
      &lt;td&gt;提交之前触发&lt;/td&gt;
      &lt;td&gt;禁止某些提交，如没有写备注&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;ul&gt;
  &lt;li&gt;监听提交&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;钩子位置：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/home/svn/hooks/post-commit&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;授予执行权限：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chmod +x /home/svn/hooks/post-commit&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;获取commit的信息&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;svnlook author $REPOS&lt;/code&gt; 最近提交的员工&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;svnlook log $REPOS&lt;/code&gt; 最近提交的备注&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;svnlook changed $REPOS&lt;/code&gt; 最近一次提交修改了哪些文件（U更新,A添加,D删除）&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ svnlook changed /home/svn
U   Java/think/app/index/controller/FootballController.php
A   Java/think/test11.txt
D   Java/think/test10.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;五svn自动部署&quot;&gt;（五）SVN自动部署&lt;/h3&gt;

&lt;h5 id=&quot;本地部署&quot;&gt;本地部署&lt;/h5&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/sh&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;REPOS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;REV&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$2&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;RECORD&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;svnlook log &lt;span class=&quot;nv&quot;&gt;$REPOS&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;,&lt;span class=&quot;nv&quot;&gt;$REPOS&lt;/span&gt;,&lt;span class=&quot;nv&quot;&gt;$REV&lt;/span&gt;,&lt;span class=&quot;nv&quot;&gt;$RECORD&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; /var/log/svnlog.txt
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;RECORD&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;deploy&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
    /usr/bin/svn update /home/web &lt;span class=&quot;nt&quot;&gt;--no-auth-cache&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; /dev/null
    &lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;www.www &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; /home/web
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;异地部署&quot;&gt;异地部署&lt;/h5&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/sh&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;REPOS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;REV&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$2&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;RECORD&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;svnlook log &lt;span class=&quot;nv&quot;&gt;$REPOS&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;,&lt;span class=&quot;nv&quot;&gt;$REPOS&lt;/span&gt;,&lt;span class=&quot;nv&quot;&gt;$REV&lt;/span&gt;,&lt;span class=&quot;nv&quot;&gt;$RECORD&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; /var/log/svnlog.txt
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;RECORD&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;deploy&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# ssh root@1.1.1.1 &quot;bash xxx.sh&quot;&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# 以其他账号登录&lt;/span&gt;
    su www &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;scp /www/wwwroot/home/* root@10.10.10.10:/www/wwwroot/home&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;生成带月份的日志文件&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;,&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;whoami&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;,&lt;span class=&quot;nv&quot;&gt;$REPOS&lt;/span&gt;,&lt;span class=&quot;nv&quot;&gt;$REV&lt;/span&gt;,&lt;span class=&quot;nv&quot;&gt;$RECORD&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; /var/log/svnlog-&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt; +%Y-%m&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;获取用户提交的目录&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;DIR&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;svnlook dirs-changed &lt;span class=&quot;nv&quot;&gt;$REPOS&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;判断用户提交的项目设置自动部署&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;RECORD&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;deploy&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;DIR&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;~ &lt;span class=&quot;s2&quot;&gt;&quot;EASYDO3.0test&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
    /usr/bin/svn update /www/wwwroot/xxxx &lt;span class=&quot;nt&quot;&gt;--username&lt;/span&gt; xxx &lt;span class=&quot;nt&quot;&gt;--password&lt;/span&gt; xxx123 &lt;span class=&quot;nt&quot;&gt;--no-auth-cache&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; /dev/null
    &lt;span class=&quot;nb&quot;&gt;chown &lt;/span&gt;www.www &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; /www/wwwroot/xxxx
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;blockquote&gt;
  &lt;p&gt;参考文档&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://www.cnblogs.com/liuxianan/p/linux_install_svn_server.html&quot;&gt;Linux下安装SVN服务端小白教程&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.cnblogs.com/larryW/articles/11276789.html&quot;&gt;svn钩子(post-commit)区分根目录上传的一级文件夹&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.mythsman.com/post/5d2ab67ff678ba2eb3bd346f/&quot;&gt;编写Shell脚本的最佳实践&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>ThinkPHP6.0导出Excel案例</title>
   <link href="https://comeround.cn/article/thinkphp6-export-excel.html"/>
   <updated>2020-03-22T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/thinkphp6-export-excel</id>
   <content type="html">&lt;h2 id=&quot;一开发环境配置&quot;&gt;（一）开发环境配置&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;系统环境：Windows10 x64&lt;/li&gt;
  &lt;li&gt;PHP集成环境：phpEnv7.1.5（https://www.phpenv.cn/）
    &lt;ul&gt;
      &lt;li&gt;PHP7.4.4&lt;/li&gt;
      &lt;li&gt;MySQL8.0.19&lt;/li&gt;
      &lt;li&gt;Nginx1.16.1&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;数据库管理工具：Navicat Premium 15.0.11&lt;/li&gt;
  &lt;li&gt;PHP依赖管理工具：Composer（https://getcomposer.org/Composer-Setup.exe）&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;二安装thinkphp60并配置&quot;&gt;（二）安装ThinkPHP6.0并配置&lt;/h2&gt;

&lt;p&gt;（1）安装ThinkPHP6.0&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;composer create-project topthink/think tp2excel
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（2）安装Excel插件phpspreadsheet&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;composer require phpoffice/phpspreadsheet
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（3）配置站点&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/thinkphp2excel.jpg&quot; alt=&quot;PHPEnv的配置-站点配置&quot; /&gt;&lt;/p&gt;

&lt;p&gt;（4）配置Nginx重写&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/thinkphp2excel2.jpg&quot; alt=&quot;PHPEnv的配置-重写&quot; /&gt;&lt;/p&gt;

&lt;p&gt;（5）启动，查看首页&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/thinkphp2excel-indexpage.jpg&quot; alt=&quot;ThinkPHP6.0首页&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;三配置数据库与数据库设计&quot;&gt;（三）配置数据库与数据库设计&lt;/h2&gt;

&lt;p&gt;（1）数据库配置&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/thinkphp2excel-database-config.jpg&quot; alt=&quot;数据库配置&quot; /&gt;&lt;/p&gt;

&lt;p&gt;（2）数据库建表（略）&lt;/p&gt;

&lt;h2 id=&quot;四查询sql数据并导出&quot;&gt;（四）查询SQL数据并导出&lt;/h2&gt;

&lt;p&gt;（1）引入Spread.php插件&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/thinkphp2excel-spread.jpg&quot; alt=&quot;引入Spread.php插件&quot; /&gt;&lt;/p&gt;

&lt;p&gt;（2）查询数据并导出&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;app\controller&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;app\BaseController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;think\facade\Db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Tools\Spread&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Index&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BaseController&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&amp;lt;html&amp;gt;&amp;lt;a href=&quot;/index/excel.html?limit=2000&quot;&amp;gt;导出Excel&amp;lt;/a&amp;gt;&amp;lt;html&amp;gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;excel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$limit&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$expTableData&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Db&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;b_demo&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;limit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$limit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;select&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$fileName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;IP地址导出&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$Excel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;fileName&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$fileName&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;Y年m月d日-His&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//or $xlsTitle&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$Excel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;cellName&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;A&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;B&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;C&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;D&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$Excel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;H&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;A&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;B&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;22&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;C&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;28&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;D&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;38&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//横向水平宽度&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$Excel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;V&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;1&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;40&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;2&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;26&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//纵向垂直高度&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$Excel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;sheetTitle&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$fileName&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//大标题，自定义&lt;/span&gt;
		&lt;span class=&quot;nv&quot;&gt;$Excel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;xlsCell&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;id&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;编号&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;start&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;开始IP&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
		    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;end&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;结束IP&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;disp&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;地区&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]];&lt;/span&gt;
		&lt;span class=&quot;nc&quot;&gt;Spread&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;excelPut&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$Excel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$expTableData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（3）导出结果&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/thinkphp2excel-result.jpg&quot; alt=&quot;导出结果&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;五部署上线非必须&quot;&gt;（五）部署上线（非必须）&lt;/h2&gt;

&lt;p&gt;部署环境：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;+ Linux CentOS8.0
+ PHP7.3.16
+ Nginx1.16.1
+ MySQL8.0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>MySQL8.0之主从复制</title>
   <link href="https://comeround.cn/article/mysql8.0-master-slave.html"/>
   <updated>2020-03-14T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/mysql8.0-master-slave</id>
   <content type="html">&lt;h2 id=&quot;一mysql主从复制概述&quot;&gt;（一）MySQL主从复制概述&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/mysql-8-master-slave.png&quot; alt=&quot;MySQL主从复制概述&quot; /&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;主从同步的定义&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;主从同步使得数据可以从一个数据库服务器复制到其他服务器上，在复制数据时，一个服务器充当主服务器（master），其余的服务器充当从服务器（slave）。因为复制是异步进行的，所以从服务器不需要一直连接着主服务器，从服务器甚至可以通过拨号断断续续地连接主服务器。通过配置文件，可以指定复制所有的数据库，某个数据库，甚至是某个数据库上的某个表。&lt;/p&gt;

&lt;p&gt;使用主从同步的好处：&lt;/p&gt;

&lt;p&gt;通过增加从服务器来提高数据库的性能，在主服务器上执行写入和更新，在从服务器上向外提供读功能，可以动态地调整从服务器的数量，从而调整整个数据库的性能。
提高数据安全，因为数据已复制到从服务器，从服务器可以终止复制进程，所以，可以在从服务器上备份而不破坏主服务器相应数据
在主服务器上生成实时数据，而在从服务器上分析这些数据，从而提高主服务器的性能&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;主从同步的机制&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Mysql服务器之间的主从同步是基于二进制日志机制，主服务器使用二进制日志来记录数据库的变动情况，从服务器通过读取和执行该日志文件来保持和主服务器的数据一致。&lt;/p&gt;

&lt;p&gt;在使用二进制日志时，主服务器的所有操作都会被记录下来，然后从服务器会接收到该日志的一个副本。从服务器可以指定执行该日志中的哪一类事件（譬如只插入数据或者只更新数据），默认会执行日志中的所有语句。&lt;/p&gt;

&lt;p&gt;每一个从服务器会记录关于二进制日志的信息：文件名和已经处理过的语句，这样意味着不同的从服务器可以分别执行同一个二进制日志的不同部分，并且从服务器可以随时连接或者中断和服务器的连接。&lt;/p&gt;

&lt;p&gt;主服务器和每一个从服务器都必须配置一个唯一的ID号（在my.cnf文件的[mysqld]模块下有一个server-id配置项），另外，每一个从服务器还需要通过CHANGE MASTER TO语句来配置它要连接的主服务器的ip地址，日志文件名称和该日志里面的位置（这些信息存储在主服务器的数据库里）&lt;/p&gt;

&lt;p&gt; 3. 配置主从同步的基本步骤&lt;/p&gt;

&lt;p&gt;有很多种配置主从同步的方法，可以总结为如下的步骤：&lt;/p&gt;

&lt;p&gt;在主服务器上，必须开启二进制日志机制和配置一个独立的ID
在每一个从服务器上，配置一个唯一的ID，创建一个用来专门复制主服务器数据的账号
在开始复制进程前，在主服务器上记录二进制文件的位置信息
如果在开始复制之前，数据库中已经有数据，就必须先创建一个数据快照（可以使用mysqldump导出数据库，或者直接复制数据文件）
配置从服务器要连接的主服务器的IP地址和登陆授权，二进制日志文件名和位置&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;详细配置主从同步的方法&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;主和从的身份可以自己指定，博主将虚拟机CentOS（172.18.194.163）中MySQL作为主服务器，将CentOS（172.18.194.168）中的MySQL作为从服务器。 在主从设置前，要保证两台CentOS之间的网络连通。&lt;/p&gt;

&lt;h2 id=&quot;二配置主服务器为master&quot;&gt;（二）配置主服务器为master&lt;/h2&gt;

&lt;p&gt;编辑&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/my.cnf&lt;/code&gt;，在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mysqld&lt;/code&gt;下面添加&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
server-id=168
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;创建slave账号并授予权限（创建账号，赋予权限，刷新权限）&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysql&amp;gt; CREATE USER &apos;slave&apos;@&apos;%&apos; IDENTIFIED BY &apos;slave123&apos;;
mysql&amp;gt; grant replication slave on *.* to slave@&apos;%&apos;;
mysql&amp;gt; FLUSH PRIVILEGES;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;查看主数据库的日志位置 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;show master status;&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysql&amp;gt; show master status;
+---------------+----------+--------------+------------------+-------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+---------------+----------+--------------+------------------+-------------------+
| binlog.000004 |     9349 |              |                  |                   |
+---------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;三备份主服务器原有数据到从服务器&quot;&gt;（三）备份主服务器原有数据到从服务器&lt;/h2&gt;

&lt;p&gt;从主服务器导出数据&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysqldump -uroot -p --all-databases --lock-all-tables &amp;gt; ~/master_db.sql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;锁写主数据库，避免有写入&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;flush tables with read lock;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;确定主数据库无数据写入，Position无变化则无数据写入&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;show master status;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;从主服务器发送文件到从服务器&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;scp ~/master_db.sql root@172.18.194.168:/root/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在从服务器还原数据&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysql –uroot –p &amp;lt; master_db.sql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;四配置从服务器为slave&quot;&gt;（四）配置从服务器为slave&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@iZwz93o6yrkkb316rov38jZ ~]# cat /etc/my.cnf
[mysqld]
default_authentication_plugin=mysql_native_password
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
server-id=168
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;配置从数据库的主服务IP、账号、日志文件及位点&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysql&amp;gt; change master to master_host=&apos;172.18.194.163&apos;, master_user=&apos;slave&apos;, master_password=&apos;slave123&apos;,master_log_file=&apos;binlog.000004&apos;, master_log_pos=9349;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;启动从数据库服务：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;start slave;&lt;/code&gt;，如果从数据库已经启动，先关闭从跟踪 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;stop slave;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;开启主数据写锁&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;unlock tables;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;查看当前跟踪情况&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysql&amp;gt; show slave status \G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 172.18.194.163
                  Master_User: slave
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.000004
          Read_Master_Log_Pos: 9349
               Relay_Log_File: iZwz93o6yrkkb316rov38jZ-relay-bin.000002
                Relay_Log_Pos: 1179
        Relay_Master_Log_File: binlog.000004
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 9349
              Relay_Log_Space: 1405
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 1
                  Master_UUID: be7169eb-32f4-11ea-be61-00163e109db6
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
           Master_Retry_Count: 86400
                  Master_Bind:
      Last_IO_Error_Timestamp:
     Last_SQL_Error_Timestamp:
               Master_SSL_Crl:
           Master_SSL_Crlpath:
           Retrieved_Gtid_Set:
            Executed_Gtid_Set:
                Auto_Position: 0
         Replicate_Rewrite_DB:
                 Channel_Name:
           Master_TLS_Version:
       Master_public_key_path:
        Get_master_public_key: 0
            Network_Namespace:
1 row in set (0.00 sec)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;五验证主从复制是否生效&quot;&gt;（五）验证主从复制是否生效&lt;/h2&gt;

&lt;p&gt;1.在主服务器上修改数据，并查看&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Position&lt;/code&gt;，查看从服务器的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Read_Master_Log_Pos&lt;/code&gt;的参数是否一致。&lt;/p&gt;

&lt;p&gt;2.测试主库增删改操作从数据库数据是否一致&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Docker~</title>
   <link href="https://comeround.cn/article/docker-white.html"/>
   <updated>2020-03-07T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/docker-white</id>
   <content type="html">&lt;h6 id=&quot;docker就是一条船&quot;&gt;Docker：就是一条船&lt;/h6&gt;

&lt;p&gt;在docker上运行nginx，然后把端口映射到宿主机，就可以直接访问宿主机的IP来访问docker&lt;/p&gt;

&lt;p&gt;把本地文件映射到docker的相应目录，对docker进行操作&lt;/p&gt;

&lt;h2 id=&quot;一docker安装&quot;&gt;一、Docker安装&lt;/h2&gt;

&lt;h3 id=&quot;1linux安装&quot;&gt;（1）Linux安装&lt;/h3&gt;

&lt;p&gt;安装docker &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yum install docker -y&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;启动docker &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;systemctl start docker&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;下载nginx镜像 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker pull nginx&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;配置目录 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/nginx/www&lt;/code&gt;，编辑&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.html&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;运行docker中的nginx &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker run --name nd -p 80:80 -v ~/nginx/www:/usr/share/nginx/html -d nginx&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker run --name f1 -p 80:80 -v ~/html:/usr/share/nginx/html -v ~/nginx:/etc/nginx -d nginx:1.16.1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;在宿主机访问80端口&lt;/p&gt;

&lt;p&gt;docker查看容器的文件 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker exec f1 ls /etc/nginx/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;从容器复制文件到宿主机 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker cp f1:/etc/nginx .&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;重启容器的nginx &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker exec f2 service nginx reload&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;运行容器中的centos &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker run -it centos&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@template ~]# curl http://localhost/
&amp;lt;html&amp;gt;
这是一个网页
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;2windows安装&quot;&gt;（2）Windows安装&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;下载地址：https://hub.docker.com/editions/community/docker-ce-desktop-windows&lt;/li&gt;
  &lt;li&gt;安装Hyper-V &lt;a href=&quot;https://jingyan.baidu.com/article/d7130635e5678113fcf4757f.html&quot;&gt;家庭版安装&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;安装WSL2 &lt;a href=&quot;https://docs.microsoft.com/zh-cn/windows/wsl/install-win10#step-4---download-the-linux-kernel-update-package&quot;&gt;下载&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;二docker的使用&quot;&gt;二、Docker的使用&lt;/h2&gt;

&lt;h3 id=&quot;1常用命令&quot;&gt;（1）常用命令&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker info #查看运行状态
docker search nginx #搜索版本
docker pull nginx:1.17.8 #安装最新版nginx
docker images #查看当前镜像
docker ps #查看当前运行的容器
docker inspect [image] #查看容器配置
docker inspect --format=&apos;{{.NetworkSettings.IPAddress}}&apos; php74-6 #查看容器的IP
docker stop container
docker rm container
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;2容器操作&quot;&gt;（2）容器操作&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker run --name nginx -p 9090:80 nginx:1.17.8 -d nginx
docker run --name yourname -d -p 8080:80 nginx:1.21.0
docker run --name baota -d -p 8888:8888 centos
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;3docker容器中安装vi命令&quot;&gt;（3）docker容器中安装vi命令&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-get update
apt-get install vim
apt-get install iputils-ping #安装ping命令
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;https://www.cnblogs.com/wicub/p/6924018.html&lt;/p&gt;

&lt;h3 id=&quot;4安装centos&quot;&gt;（4）安装centos&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker pull centos
docker run --name yourname -idt -p 8888:8888 centos:latest
# yum update -y
# ...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;//脚本优化
# yum install net-tools -y                                  #安装ifconfig命令
# yum install vim -y                                        #安装vim命令
# echo &quot;alias ll= &apos;ls -l&apos;&quot; &amp;gt;&amp;gt; ~/.bashrc &amp;amp;&amp;amp; source ~/.bashrc #安装ll命令
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;端口映射&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker run --name baota1 -idt -p 18888:8888 -p 10080:80 -p 13306:3306 -p 10443:443 -p 10022:22 centos:latest
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;5docker部署php项目&quot;&gt;（5）Docker部署php项目&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker pull php:7.4-fpm
# 普通PHP
docker run --name php74-3 -v &quot;D:\phpEnv\www\d.fe80.cn\public&quot;:/var/www/html -idt -p 19011:9000 php:7.4-fpm
# ThinkPHP
docker run --name php74-6 -v &quot;D:\phpEnv\www\d.fe80.cn&quot;:/var/www -v &quot;D:\phpEnv\www\d.fe80.cn\public&quot;:/var/www/html -idt -p 19011:9000 php:7.4-fpm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;宿主机Nginx的配置&lt;/p&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;[^/]\.php(/|$)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;fastcgi_pass&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;127.0.0.1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;19011&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;fastcgi_index&lt;/span&gt;  &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;php/pathinfo&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.conf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;fastcgi.conf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;fastcgi_param&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;SCRIPT_FILENAME&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/var/www/html&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$fastcgi_script_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#需要这一行&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;PHP容器安装redis扩展&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pecl install -o -f redis
echo &quot;extension=redis.so&quot; &amp;gt;&amp;gt; /usr/local/etc/php/conf.d/php.ini
docker-php-ext-enable redis
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;6部署mysql&quot;&gt;（6）部署MySQL&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# docker pull mysql:latest
# docker run --name mysql8 -e MYSQL_ROOT_PASSWORD=betapass -idt -p 3306:3306 mysql:latest
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;把目录映射到宿主机上&quot;&gt;把目录映射到宿主机上&lt;/h5&gt;

&lt;blockquote&gt;
  &lt;p&gt;注意：使用docker部署MySQL数据库，需要把数据库文件映射到宿主机上，避免docker宕机导致数据丢失。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;需要编写&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/docker/mysql/conf/my.cnf&lt;/code&gt;配置文件&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# mkdir /docker/mysql/{data,conf,logs}
# 把自定义配置的my.cnf写入到/docker/mysql/conf/my.cnf
# docker run --name mysql8 -e MYSQL_ROOT_PASSWORD=betapass -idt -p 3306:3306 -v /docker/mysql/conf:/etc/mysql/conf.d -v /docker/mysql/data:/var/lib/mysql mysql:latest
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;解决only_full_group_by的报错问题&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;set global sql_mode=&apos;NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES&apos;;
set session sql_mode=&apos;NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES&apos;;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;7部署nginx&quot;&gt;（7）部署Nginx&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker pull nginx:latest
docker run --name nginxweb -p 80:80 -v /www:/usr/share/nginx/html -d nginx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;8安装mongodb&quot;&gt;（8）安装MongoDB&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;安装&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker pull mongo
docker run -itd --name mongo6docker -p 27017:27017 mongo --auth
$ docker exec -it mongo6docker mongo admin
$ docker exec -it mongo6docker /bin/mongosh admin //直接使用docker里面的命令
# 创建一个名为 admin，密码为 beta123456 的用户。
&amp;gt; db.createUser({ user:&apos;root&apos;,pwd:&apos;beta123456&apos;,roles:[ { role:&apos;userAdminAnyDatabase&apos;, db: &apos;admin&apos;},&quot;readWriteAnyDatabase&quot;]});
# 尝试使用上面创建的用户信息进行连接。
&amp;gt; db.auth(&apos;root&apos;, &apos;beta123456&apos;)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;恢复本地文件到数据库&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# 把宿主机的文件复制到docker容器
docker cp . mongo4docker:/mongodata

# 恢复数据
docker exec -it mongo4docker /bin/mongorestore -h 127.0.0.1:27017 --db linzening -u root -p password0 --authenticationDatabase &quot;admin&quot; /mongodata
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;文件映射： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-v /docker/mongo:/data/db&lt;/code&gt;&lt;/p&gt;

&lt;h3 id=&quot;9部署net-core&quot;&gt;（9）部署.net core&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;创建项目，添加docker支持，会生成一个Dockerfile的文件，把Dockerfile移动到上一层目录；&lt;/li&gt;
  &lt;li&gt;编译.NetCore，会生成一个net镜像：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker build -t dotnetdocker .&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;运行容器：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker run --name=dotnetdocker -p 8000:80 dotnetdocker&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;再用Nginx反向代理到8000端口&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;三docker-compose和dockerfile&quot;&gt;三、docker-compose和Dockerfile&lt;/h2&gt;

&lt;h3 id=&quot;1docker-compose使用&quot;&gt;（1）docker-compose使用&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;安装docker-compose命令&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl -L &quot;https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)&quot; -o /usr/local/bin/docker-compose

chmod +x /usr/local/bin/docker-compose

ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

docker-compose --version
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;文件名：docker-compose.yml&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker-compose up&lt;/code&gt;   安装&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-docker highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;version: &quot;2&quot;

services:
  mysql:
    image: mysql:8.0.25
    restart: always
    command: --default-authentication-plugin=mysql_native_password
    container_name: thinkcmf-db
    environment:
      - MYSQL_ROOT_PASSWORD=Root@123
      - MYSQL_USER=thinkcmf
      - MYSQL_PASSWORD=Thinkcmf@123
      - MYSQL_DATABASE=thinkcmf
      - TZ=Asia/Shanghai
    volumes:
      - /home/mysql:/var/lib/mysql
    ports:
      - &quot;3306:3306&quot;
      - &quot;80:80&quot;
    expose:
      - 80

  thinkcmf:
    build: .
    network_mode: service:mysql
    restart: always
    container_name: thinkcmf-web
    depends_on:
      - mysql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h6 id=&quot;学习文档&quot;&gt;学习文档&lt;/h6&gt;

&lt;p&gt;&lt;a href=&quot;https://my.oschina.net/u/1388595/blog/5078146&quot;&gt;史上最详细的docker学习手册&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>阿里云NAS使用笔记</title>
   <link href="https://comeround.cn/article/aliyun-nas.html"/>
   <updated>2020-02-27T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/aliyun-nas</id>
   <content type="html">&lt;p&gt;（1）创建NAS和购买ECS&lt;/p&gt;

&lt;p&gt;（2）NAS创建文件系统&lt;/p&gt;

&lt;p&gt;（3）添加挂载点&lt;/p&gt;

&lt;p&gt;（4）挂载文件系统到ECS&lt;/p&gt;

&lt;p&gt;在Linux ECS上安装CIFS客户端&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yum install nfs-utils -y&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;挂载SMB文件系统&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo mount -t cifs //296cb49ec3-vrj4.cn-shenzhen.nas.aliyuncs.com/myshare /mnt -o vers=2.0,guest,uid=0,gid=0,dir_mode=0755,file_mode=0755,mfsymlinks,cache=strict,rsize=1048576,wsize=1048576&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;执行以下命令，如果查询结果不为空，则说明挂载成功：
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;df -h | grep 296cb49ec3-vrj4.cn-shenzhen.nas.aliyuncs.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;进入&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/mnt&lt;/code&gt;即挂载点，进行文件操作&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;参考文档&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://help.aliyun.com/document_detail/27526.html?spm=a2c4g.11186623.6.564.230e31316cBN8o&quot;&gt;Linux系统挂载容量型或性能型NAS&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Bash之foreach命令笔记</title>
   <link href="https://comeround.cn/article/bash-foreach-cmd.html"/>
   <updated>2020-02-22T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/bash-foreach-cmd</id>
   <content type="html">&lt;h3 id=&quot;这篇文章你们看不见&quot;&gt;这篇文章你们看不见&lt;/h3&gt;

&lt;p&gt;（1）for命令用法&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;for i in {1..100..2}; do echo $i; done
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（2）seq命令&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;seq 8 12
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;8
9
10
11
12
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（3）foreach命令&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;foreach -w 1 -c 10 &quot;echo 111&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;iplist.txt为一个IP列表，需要逐个ping这些IP&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cat iplist.txt |foreach -w 1 -c 1 &quot;ping #1 -c 1&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在被控制的机器上操作&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cat iplist.txt |foreach -w 1 -c 1 &quot;s #1 &apos;echo 666&apos;&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>贵州省情</title>
   <link href="https://comeround.cn/article/guizhou-construct.html"/>
   <updated>2020-01-01T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/guizhou-construct</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;贵州省城市建设&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;身份证号&quot;&gt;身份证号&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;城市名称&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;身份证开头&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;车牌号&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵阳市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;5201&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵A&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;六盘水市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;5202&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵B&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;遵义市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;5221/5203&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵C&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;安顺市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;5225/5204&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵G&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;铜仁地区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;5222/5206&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵D&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔西南州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;5223&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵E&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;毕节地区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;5224/5205&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵F&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;5226&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵H&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔南州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;5227&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵J&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;区县编码&quot;&gt;区县编码&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;编号&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;名称&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;备注&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520101&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵阳市市辖区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;不存在&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520102&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵阳市南明区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520103&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵阳市云岩区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520111&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵阳市花溪区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520112&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵阳市乌当区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520113&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵阳市白云区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520114&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵阳市小河区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;已合并&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520115&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵阳市观山湖区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520181&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵阳市清镇市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520121&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵阳市开阳县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520122&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵阳市息烽县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520123&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵阳市修文县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520201&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;六盘水市钟山区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520203&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;六盘水市六枝特区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520205&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;六盘水市水城区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520281&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;六盘水市盘州市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520302&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;遵义市红花岗区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520303&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;遵义市汇川区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520381&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;遵义市赤水市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520382&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;遵义市仁怀市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520304&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;遵义市播州区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520322&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;遵义市桐梓县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520323&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;遵义市绥阳县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520324&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;遵义市正安县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520325&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;遵义市道真县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520326&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;遵义市务川县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520327&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;遵义市凤冈县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520328&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;遵义市湄潭县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520329&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;遵义市余庆县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520330&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;遵义市习水县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520602&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;铜仁市碧江区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520603&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;铜仁市万山区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520621&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;铜仁市江口县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520622&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;铜仁市玉屏县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520623&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;铜仁市石阡县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520624&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;铜仁市思南县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520625&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;铜仁市印江县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520626&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;铜仁市德江县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520627&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;铜仁市沿河县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520628&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;铜仁市松桃县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522301&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔西南州兴义市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522302&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔西南州兴仁市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522323&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔西南州普安县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522324&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔西南州晴隆县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522325&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔西南州贞丰县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522326&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔西南州望谟县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522327&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔西南州册亨县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522328&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔西南州安龙县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520502&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;毕节市七星关区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520521&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;毕节市大方县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520522&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;毕节市黔西县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520523&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;毕节市金沙县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520524&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;毕节市织金县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520525&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;毕节市纳雍县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520526&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;毕节市威宁县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520527&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;毕节市赫章县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520402&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;安顺市西秀区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520403&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;安顺市平坝区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520422&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;安顺市普定县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520423&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;安顺市镇宁县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520424&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;安顺市关岭县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;520425&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;安顺市紫云县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522601&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州凯里市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522622&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州黄平县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522623&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州施秉县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522624&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州三穗县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522625&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州镇远县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522626&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州岑巩县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522627&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州天柱县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522628&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州锦屏县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522629&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州剑河县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522630&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州台江县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522631&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州黎平县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522632&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州榕江县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522633&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州从江县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522634&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州雷山县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522635&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州麻江县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522636&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔东南州丹寨县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522701&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔南州都匀市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522702&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔南州福泉市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522722&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔南州荔波县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522723&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔南州贵定县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522725&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔南州瓮安县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522726&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔南州独山县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522727&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔南州平塘县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522728&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔南州罗甸县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522729&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔南州长顺县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522730&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔南州龙里县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522731&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔南州惠水县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;522732&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黔南州三都县&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;一贵州省&quot;&gt;一、贵州省&lt;/h2&gt;

&lt;h3 id=&quot;1三环八射铁路项目&quot;&gt;（1）三环八射铁路项目&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/guizhou-sanhuanbashe.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;2高速公路网&quot;&gt;（2）高速公路网&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2021/guizhou-gaosu.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;二贵阳市&quot;&gt;二、贵阳市&lt;/h2&gt;

&lt;h3 id=&quot;1贵阳环城快铁&quot;&gt;（1）贵阳环城快铁&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/guiyang-1-round.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2021/guiyang-huantie.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;2贵阳地铁&quot;&gt;（2）贵阳地铁&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/guiyang-ditie.jpg&quot; alt=&quot;&quot; /&gt;
&lt;img src=&quot;/public/blog/2020/guiyang-ditie-2.jpg&quot; alt=&quot;&quot; /&gt;
&lt;img src=&quot;/public/blog/2021/metro-man-tuiyang-ditie-2024-p.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;二黔东南州&quot;&gt;二、黔东南州&lt;/h2&gt;

&lt;h3 id=&quot;1凯里环城高速&quot;&gt;（1）凯里环城高速&lt;/h3&gt;

&lt;h3 id=&quot;2黎平区域高速&quot;&gt;（2）黎平区域高速&lt;/h3&gt;

&lt;h4 id=&quot;剑黎高速&quot;&gt;剑黎高速&lt;/h4&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/jianli-gaosu.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;3玉屏至从江高铁&quot;&gt;（3）玉屏至从江高铁&lt;/h3&gt;

&lt;p&gt;项目设计时速350km/h,建成后将开行长途动车组，兼顾城际客运业务和长途客运业务。此线路为沪昆客运专线与贵广客运专线联络线，通车后，铜仁方向高铁列车将由此线路转往贵广客运专线。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/yucong.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/yucong-jinping.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;4丹寨至天柱高速公路&quot;&gt;（4）丹寨至天柱高速公路&lt;/h3&gt;

&lt;p&gt;由丹寨县扬武镇引出，和余安高速交叉，之后往东北经雷山县大塘镇，在大塘镇与雷榕高速十字交叉，之后以隧道形式穿越雷公山国家自然保护区，过榕江县平阳乡，之后往东北经榕江县朗洞镇，在朗洞镇与剑榕高速十字交叉，之后沿808县道往东北过黎平县德化乡，之后继续往东北经剑河县南加镇，在南加镇与剑黎高速十字交叉，之后往北经锦屏县彦洞乡，之后往东北经天柱县石洞镇，之后折往东，终于天柱县高酿镇。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/dan-tian.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/qiandongnan-gaosu.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;5其他线路涪陵-柳州玉屏-从江兴永郴赣州铁路&quot;&gt;（5）其他线路：涪陵-柳州、玉屏-从江、兴永郴赣州铁路&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/gaotie-qiandongnan.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;涪柳铁路2020年10月路线图&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/fuliu-tielu.jpg&quot; alt=&quot;涪陵-柳州铁路&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;6榕江-从江出省高速&quot;&gt;（6）榕江-从江出省高速&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/congjiang-chusheng.jpg&quot; alt=&quot;榕江-从江&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;7天柱出省高速天柱-新晃天柱-会同&quot;&gt;（7）天柱出省高速：天柱-新晃、天柱-会同&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/tianzhu-xinhuang.jpg&quot; alt=&quot;天柱-新晃&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/tianzhu-huitong.jpg&quot; alt=&quot;天柱-会同&quot; /&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;数据来源&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://mcmcrt.china-emu.cn/HSR/&quot;&gt;高速铁路&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://openrailwaymap.org/&quot;&gt;OpenRailwayMap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/public/blog/2020/guizhou202004.pdf&quot;&gt;贵州省地图&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Bash脚本笔记</title>
   <link href="https://comeround.cn/article/bash-script.html"/>
   <updated>2019-10-09T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/bash-script</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;本笔记为自己的bash快捷脚本，只需要复制命令即可一键安装。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;脚本地址：http://hello.fe80.cn/bash/&lt;/p&gt;

&lt;p&gt;安装lnmp及设置：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wget http://hello.fe80.cn/bash/install.sh &amp;amp;&amp;amp; bash install.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;安装MySQL8.0.16：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wget http://hello.fe80.cn/bash/mysql8016.sh &amp;amp;&amp;amp; bash mysql8016.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;安装MySQL8.0.18（CentOS8）：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wget http://hello.fe80.cn/bash/mysql8018el8.sh &amp;amp;&amp;amp; bash mysql8018el8.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;安装Python-3.8.0：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wget http://hello.fe80.cn/bash/python38.sh &amp;amp;&amp;amp; bash python38.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;安装openresty：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wget http://hello.fe80.cn/bash/openresty.sh &amp;amp;&amp;amp; bash openresty.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;安装MongoDB：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wget http://hello.fe80.cn/bash/mongo.sh &amp;amp;&amp;amp; bash mongo.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;安装Postgresql：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wget http://hello.fe80.cn/bash/postgresql.sh &amp;amp;&amp;amp; bash postgresql.sh&lt;/code&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>IPv6地址分配</title>
   <link href="https://comeround.cn/article/ipv6-address.html"/>
   <updated>2019-09-11T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/ipv6-address</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;之前分享过一个关于国内三大运营商IPv6地址段分配的文件（&lt;a href=&quot;http://www.txrjy.com/thread-1058746-1-1.html&quot;&gt;IPv6地址段分配情况（部分）&lt;/a&gt;），看了下还是有很多评论的，并且很多伙伴说这个数据非常有用。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;我一直在纠结IPv6在国际上是怎么分配的，我国分配到了50286个/32地址段（2019年6月，含港澳台），截至2020年12月IPv6地址数量为57634块/32，那么又是哪些地址段呢。网上的很多博客文章上面只说IPv6是什么，什么样的格式，但是都没有具体说是哪些IP段，因此，本人收集了很多数据，并对部分数据做了统计，在此分享给大家。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;说明：这些资料是根据已有数据统计的，不保证数据准确性，部分数据不含港澳台。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;一国际ipv6地址分配&quot;&gt;一、国际IPv6地址分配&lt;/h2&gt;

&lt;p&gt;IPv6全球单播地址为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2000::/3&lt;/code&gt;，即&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2000:: - 3fff:ffff&lt;/code&gt;。目前，IPv6已分配 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2000::/4&lt;/code&gt; ，其中各区域分配如下&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;（1）2000::/8 主要是IPv6互联网前期分配，在全球各地均有分配使用
（2）2400::/8 主要由APNIC管理（亚太互联网络信息中心）
（3）2600::/8 主要由ARIN管理（美洲互联网号码注册管机构）
（4）2800::/8 主要由LACNIC管理（拉丁美洲和加勒比地区互联网地址注册管理机构）
（5）2a00::/8 主要由RIPE管理（欧洲互联网络信息中心）
（6）2c00::/8 主要由AfriNIC管理（非洲互联网络信息中心）
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/ipv6-rir.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;IANA指定的注册机构则从地址空间2001:/16分配/23前缀，具体如下:&lt;/p&gt;

&lt;p&gt;(1) 2001:0200::/23与2001:0C00::/23分配给亚太地区(APNIC)&lt;/p&gt;

&lt;p&gt;(2) 2001:0400::/23分配给美国(ARIN)&lt;/p&gt;

&lt;p&gt;(3) 2001:0600::/23到2001:0800::/23分配给欧洲和中东(RIPE NCO这些注册机构再从IANA得到的地址空间分配/32前缀给IPv6 ISP, IPv6ISP再从32前缀中分配/48前缀给每个客户。/48 前缀的地址空间还可以进一-步分为/64前缀的子网。这样每个客户最大可以有65535个子网。&lt;/p&gt;

&lt;p&gt;其他资料&lt;a href=&quot;https://www.iana.org/assignments/ipv6-unicast-address-assignments/ipv6-unicast-address-assignments.xhtml&quot;&gt;IPv6单播地址&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;二国内ipv6地址大段&quot;&gt;二、国内IPv6地址大段&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;网段&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;运营商&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;掩码位&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;IP数量(/32)&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e::/18&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国电信(201812增加后3段)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;18&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;16384&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8000::/20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国联通(201205)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4096&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8000::/20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国移动(201108)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4096&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:c000::/20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国石油化工集团有限公司(201808)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4096&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:c000::/20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国教育网(201901)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4096&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4000::/21&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国广播电视网络有限公司(201712)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;21&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2048&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:8000::/21&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国铁通(移动)(201301)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;21&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2048&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:8000::/21&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国经济信息网(201308)/国家政务网内网(国家信息中心)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;21&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2048&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:8000::/21&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国石油天然气集团公司(201409)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;21&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2048&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:4000::/21&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;赛尔新技术(北京)有限公司(201902)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;21&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2048&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4000::/22&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云计算有限公司(201512)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;22&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;1024&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4000::/22&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京百度网讯科技有限公司(201811)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;22&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;1024&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:8000::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;交通运输部公路科学研究院(201502)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;256&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240f:4000::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;深圳市腾讯计算机系统有限公司(201907)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;256&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240f:8000::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;亚马逊通技术服务(北京)有限公司(201504)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;256&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240f:c000::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京京东叁佰陆拾度电子商务有限公司(20190917)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;256&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:dd00::/28&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;科技网(CSTNET,201105)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;28&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;16&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c::/28&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京天地互连信息技术有限公司(200807)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;28&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;16&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:4510::/29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;长城(200601)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;8&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:a980::/29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;赛尔新技术(北京)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;8&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2406:cf00::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京天地祥云科技有限公司&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;教育网（高校）&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:da8::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;教育网（高校）&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2403:800::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国南方电网有限责任公司(200808)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:6000::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中电飞华通信股份有限公司20200716&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;256&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:2000::/21&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;华为软件技术20200721&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;21&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;256&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:6000::/20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;浙江吉利控股集团有限公司20201022&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4096&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:2000::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京光环新网科技股份有限公司20201103&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;256&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:6000::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;水利部信息中心-20210114&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;256&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:a000::/20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;教育网-20210401&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4096&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:2000::/22&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;国家石油天然气管道集团20211118&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;22&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;1024&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:6000::/20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;字节跳动20221020&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4096&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:a000::/25&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;未知20221117&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;25&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;128&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:e000::/26&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;清华大学20221222&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;26&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;64&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4000::/22&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云境外(20181015)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;22&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;1024&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c000::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云境外(20190513)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;256&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:c800::/29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;【香港】电讯盈科商用网络hkt-enterprise.com&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;8&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2404:c800::/29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;【香港】电讯盈科公众宽带&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;8&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:8800::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;【香港】电讯盈科pccw.com&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;8&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:b000::/21&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;【台湾】中华电信cht.com.tw&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;26&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;64&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:8000::/26&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;【台湾】远传电信新世纪资通fetnet.net&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;26&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;64&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2404::/26&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;【台湾】亚太电信aptg.com.tw&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;26&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;64&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;附表：运营商AS编码&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;AS码号&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;运营商&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;主要IP段&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;AS4134&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e::/18&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;AS9808&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;移动&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8000::/20&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;AS4837&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;联通&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8000::/20&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;AS23910&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;教育网&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250::/32 2001:da8::/32 240c:c000::/20&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;AS137726&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;石油化工&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:c000::/20&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;AS133111&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;赛尔新技术&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:4000::/21&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;AS37963&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:3200::/32 2408:4000::/22&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;AS38365&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;百度&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:da00::/32 240c:4000::/22&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;AS45090&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00::/32&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;AS55990&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;华为云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2407:c080::/32&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;AS131486&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;京东云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:db40::/32&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;AS4812&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;京东云电信&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2403:1ec0::/32&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;三大段拥有数&quot;&gt;三、大段拥有数&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;掩码位&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;数量（个）&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;本段IP数（/32）&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;IP数（/32）&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;18&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;1&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;16384&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;16384.00&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4096&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;16384.00&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;21&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;5&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2048&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;10240.00&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;22&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;1024&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2048.00&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;3&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;256&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;768.00&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;28&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;16&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;32.00&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;8&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;32.00&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;1&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.00&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;3&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;6.00&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;1663&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;1&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;1663.00&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;33&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;8&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;0.5&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.00&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;34&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;7&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;0.25&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;1.75&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;35&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;7&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;0.125&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;0.88&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;7&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;0.0625&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;0.44&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;37&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;5&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;0.03125&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;0.16&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;38&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;8&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;0.015625&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;0.13&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;总计：&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;47568.34&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;四教育网高校分配部分&quot;&gt;四、教育网高校分配（部分）&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;地区&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;省份&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;开始IP段&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;结束IP段&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国北京市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:0200::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:03ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国天津市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;天津市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:0400::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:05ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国河北省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;河北省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:0800::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:09ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国山西省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;山西省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:0c00::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:0cff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国内蒙古&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;内蒙古&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:0e00::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:0cff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国陕西省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;陕西省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:1000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:1000:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国甘肃省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;甘肃省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:1400::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:14ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国新疆区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;新疆区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:1800::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:18ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国宁夏区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;宁夏区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:1c00::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:1cff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国青海省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;青海省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:1e00::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:1eff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国四川省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;四川省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:2000::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:20ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国重庆市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;重庆市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:2400::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:24ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国云南省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;云南省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:2800::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:28ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国贵州省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵州省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:2c00::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:2cff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国西藏区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;西藏区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:2e00::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:2eff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国广东省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广东省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:3000::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:30ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国广西区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广西区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:3400::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:34ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国海南省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;海南省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:3800::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:38ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国深圳市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;深圳市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:3c00::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:3cff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国湖北省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;湖北省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:4000::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:40ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国湖南省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;湖南省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:4400::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:44ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国河南省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;河南省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:4800::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:48ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国江苏省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;江苏省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:5000::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:50ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国安徽省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;安徽省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:5400::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:54ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国山东省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;山东省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:5800::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:58ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国上海市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;上海市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:6000::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:60ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国浙江省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;浙江省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:6400::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:64ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国福建省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;福建省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:6800::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:68ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国江西省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;江西省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:6c00::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:6cff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国辽宁省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;辽宁省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:7000::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:70ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国吉林省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;吉林省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:7400::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:74ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国黑龙江&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;黑龙江&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:7800::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2001:250:78ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;五中国电信&quot;&gt;五、中国电信&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;所属IP段&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;地区&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;运营商&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;开始IP&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;结束IP&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e::/26&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信骨干网、城域网&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:3f:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:40:/26&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信业务平台&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:40::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:7f:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:80:/25&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;综合网络&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:80::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:100::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信城域网&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:100::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:1ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:200::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信业务平台&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:200::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:2ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:300::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信公众宽带&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:300::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:3ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:400::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信LTE网络&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:400::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:4ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:500::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信IP专网&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:500::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:5ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:600::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信政企专线&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:600::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:6ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:700::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信政企专线&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:700::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:7ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:800::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信物联网络&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:800::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:8ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:900::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信IDC&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:900::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:9ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:a00::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信网吧网络&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:a00::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:aff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:b00::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信公众宽带&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:b00::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:bff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:c00::/22&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;未使用&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:c00::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:fff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:1000::/20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;未使用&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:1000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:1fff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:2000::/20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;未使用&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:2000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:2fff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:3000::/20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;未使用&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:3000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:3fff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;六中国联通&quot;&gt;六、中国联通&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;所属IP段&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;地区&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;运营商&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;开始IP&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;结束IP&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8000::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;联通城域网&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8000:1000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8000:1fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8100::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;联通骨干网&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8100::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8100:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8200::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;联通公众宽带&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8200::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:82ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8300::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;联通公众宽带&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8300::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:83ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8400::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;联通LTE&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8400::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:84ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8500::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;联通IP专网&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8500::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:85ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8600::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;联通政企专线&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8600::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:86ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8700::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;联通IDC&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8700::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:87ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8800::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;联通物联网络&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8800::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:88ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8900::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;联通物联网络&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8900::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:89ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;七中国移动&quot;&gt;七、中国移动&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;所属IP段&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;地区&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;运营商&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;开始IP&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;结束IP&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8000::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国移动城域网&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8001:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8100::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;移动IP专网&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8100::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:86ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8700::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;移动政企专线&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8700::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:87ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8800::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;移动IP专网&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8800::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:88ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8900::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;移动LTE网络&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8900::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:89ff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a00::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;移动公众宽带&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a00::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8aff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8b00::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;移动WLAN热点&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8b00::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8bff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8c00::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;移动IDC&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8c00::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8cff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8d00::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;移动物联网络&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8d00::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8dff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8e00::/24&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;移动物联网络&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8e00::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8eff:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;中国广电&quot;&gt;中国广电&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;所属IP段&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;地区&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;运营商&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;开始IP&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;结束IP&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42d8::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;重庆&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广电无线基站&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42d8::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42d9:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42da::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广电无线基站&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42da::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42db:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42dc::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;四川&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广电无线基站&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42dc::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42dd:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42de::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;云南&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广电无线基站&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42de::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42df:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42e2::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广电无线基站&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42e2::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42e2:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42e3::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广电无线基站&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42e3::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:42e3:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;八云厂商ipv6地址记录&quot;&gt;八、云厂商IPv6地址记录&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;所属IP段&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;云厂商&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;地区&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;开始IP&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;结束IP&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:3200::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;杭州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:3200::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:3200:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:b200::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;蚂蚁金服&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:b200::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:b200:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4000::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4000:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4001::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;河北张家口&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4001::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4001:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4002::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;上海&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4002::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4002:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4003::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;深圳&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4003::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4003:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4004::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;呼和浩特&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4004::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4004:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4005::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;杭州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4005::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4005:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4006::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;成都&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4006::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4006:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4007::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4007::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4007:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4008::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;河源&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4008::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4008:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4009::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;DNS段*&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4009::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4009:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:400a::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:400a::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:400a:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:400b::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;乌兰察布&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:400b::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:400b:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:400c::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:400c::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:400c:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:400d::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:400d::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:400d:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:400e::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;青岛&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:400e::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:400e:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4011::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;福州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4011::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4011:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4013::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;武汉&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4013::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4013:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4015::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;南京&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4015::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:4015:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4000::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;新加坡&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4000:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4001::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;香港&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4001::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4001:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4002::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;美国弗吉尼亚州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4002::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4002:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4004::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;美国硅谷&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4004::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4004:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4005::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;德国法兰克福&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4005::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4005:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4007::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;菲律宾马尼拉&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4007::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4007:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4009::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;日本东京&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4009::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4009:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:400b::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;印度尼西亚雅加达*&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:400b::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:400b:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:400c::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;沙特利雅得&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:400c::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:400c:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:400d::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;韩国首尔&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:400d::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:400d:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:400e::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;马来西亚吉隆坡&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:400e::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:400e:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:400f::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;泰国曼谷&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:400f::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:400f:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4013::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;阿里云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;墨西哥&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4013::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240b:4013:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4081::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;百度云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4081::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4081:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4082::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;百度云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;保定&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4082::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4082:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4084::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;百度云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;苏州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4084::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4084:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4085::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;百度云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4085::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4085:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4088::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;百度云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;武汉&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4088::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4088:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4089::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;百度云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;上海&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4089::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:4089:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:408c::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;百度云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;成都&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:408c::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240c:408c:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:2b40::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;百度云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;香港/新加坡&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:2b40::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:2b40:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;总&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00::/47&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;深圳&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1f:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:20::/47&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:20::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:2f:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:30::/47&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;上海&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:30::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:3f:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:40::/47&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:40::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:4f:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:90::/47&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;成都&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:90::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:9f:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:a0::/47&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;南京&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:a0::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:af:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:b0::/47&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;深圳&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:b0::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:bf:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:c0::/47&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;天津&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:c0::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:cf:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1000::/41&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:11ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1200::/41&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1200::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:13ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1400::/41&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;上海&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1400::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:15ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1600::/41&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;深圳&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1600::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:16ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1700::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;成都&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1700::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:17ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1800::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;南京&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1800::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:18ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1900::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;天津&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1900::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:19ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1a00::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;重庆&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1a00::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:1aff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:4000::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:4000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:4e00:4000:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c000::/36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;新加坡&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c000:0000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c000:0fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c000:1000::/36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;新加坡&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c000:1000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c000:1fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c000:2000::/36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;香港&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c000:2000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c000:2fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c000:3000::/36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;美国弗吉尼亚州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c000:3000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c000:3fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c000:7000::/36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;巴西圣保罗&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c000:7000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c000:7fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c010::/36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;印度&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c010::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c010:fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c040::/36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;腾讯云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;香港&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c040::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240d:c040:fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2407:c080::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;华为云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;境内总&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2407:c080::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2407:c080:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2407:c080:0000::/35&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;华为云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2407:c080::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2407:c080:7ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2407:c080:0800::/35&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;华为云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;上海&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2407:c080:800::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2407:c080:fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2407:c080:1000::/35&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;华为云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京/乌兰察布&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2407:c080:1000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2407:c080:17ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2407:c080:1800::/35&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;华为云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵阳&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2407:c080:1800::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2407:c080:1fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2405:f080::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;华为云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;境外总&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2405:f080::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2405:f080:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2405:f080:000::/64&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;华为云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;新加坡&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2405:f080::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2405:f080:3ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2405:f080:400::/64&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;华为云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;香港&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2405:f080:400:ffff::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2405:f080:7ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2405:f080:800::/64&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;华为云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;泰国曼谷&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2405:f080:800:ffff::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2405:f080:bff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2405:f080:2400::/64&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;华为云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;巴西圣保罗&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2405:f080:2400:ffff::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2405:f080:27ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:1d40::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;金山云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;总&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:1d40::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:1d40:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:1d40:0000::/35&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;金山云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:1d40:0000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:1d40:1fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:1d40:2000::/36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;金山云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;上海&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:1d40:2000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:1d40:2fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:1d40:3000::/36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;金山云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:1d40:3000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:1d40:3fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:db40::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;京东云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:db40::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:db40:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2403:1ec0::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;京东云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全国&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2403:1ec0::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2403:1ec0:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p id=&quot;other&quot;&gt;其他云&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;所属IP段&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;云厂商&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;地区&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;开始IP&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;结束IP&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:e7c0::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;青云优帆&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全部&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:e7c0::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:e7c0:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:e7c0:000::/38&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;青云优帆&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:e7c0:000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:e7c0:3ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:e7c0:400::/38&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;青云优帆&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;上海&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:e7c0:400::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:e7c0:7ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:e7c0:800::/38&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;青云优帆&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广东&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:e7c0:800::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2402:e7c0:bff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:3480::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;优刻得&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;全部&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:3480::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:3480:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:3480:0000:/35&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;优刻得&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:3480::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:3480:1fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:3480:2000:/36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;优刻得&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;上海&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:3480:1000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:3480:2fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:3480:3000:/36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;优刻得&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;广州&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:3480:2000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2401:3480:3fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2404:82c0::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;优刻得&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;香港&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2404:82c0::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2404:82c0:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:0000::/36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;呼和浩特&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:0fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:1000::/36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;贵阳市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:1000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:1fff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:2000::/36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:2000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:20ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:2300::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;成都市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:2300::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:23ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:4c00::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;成都市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:4c00::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:4cff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:8900::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;昆明市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:8900::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:89ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:9000::/40&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;重庆市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:9000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:90ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:981:c000::/36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;电信云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;兰州市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:c000::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:980:c0ff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2404:de80::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;硅云*&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;香港&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2404:de80::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2404:de80:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:5280::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;美团云&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:5280::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:5280:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:89c0::/32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;新浪&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;北京&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:89c0::&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2400:89c0:ffff:ffff::&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;九省份分配规则&quot;&gt;九、省份分配规则&lt;/h2&gt;

&lt;p&gt;以运营商宽带IP为例，每个省分到的数量也不同，移动和联通顺序大致相似，电信不同&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;省份编号&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;省份名称&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;移动宽带IP段&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;联通宽带IP段&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;电信宽带IP段&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;广电电视*&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;11&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国北京市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a00::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8206::/31*3&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:304::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4100::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;12&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国天津市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a02::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8210::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:328::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4106::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;13&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国河北省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a04::/30*2&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:821a::/31*3&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:340::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:410a::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;14&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国山西省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a0c::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8226::/31*2&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:324::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4110::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;15&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国内蒙古区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a10::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:822a::/31*2&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:318::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4112::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;21&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国辽宁省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a14::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:822e::/31*3&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:30c::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4114::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;22&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国吉林省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a18::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8234::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:310::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4118::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;23&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国黑龙江省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a1a::/31*2&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8238::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:308::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:411a::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国上海市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a1e::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:820c::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:380::/28&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:411e::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;32&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国江苏省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a20::/29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:823c::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:3a0::/28&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4124::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;33&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国浙江省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a28::/29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8240::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:390::/29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4128::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;34&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国安徽省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a30::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8244::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:366::/29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:412c::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;35&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国福建省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a34::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8248::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:378::/29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4130::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;36&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国江西省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a38::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:824c::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:370::/29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4134::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;37&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国山东省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a3c::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8214::/31*3&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:344::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4138::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;41&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国河南省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a44::/29&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8220::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:33c::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:413e::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;42&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国湖北省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a4c::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:824e::/31*2&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:36f::/28&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4144::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;43&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国湖南省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a50::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8252::/31*2&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:380::/28&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4148::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;44&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国广东省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a54::/30*2&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8256::/31*3&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:3b0::/28&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:414c::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;45&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国广西区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a5c::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:825c::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:350::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4152::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;46&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国海南省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a5e::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8260::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:314::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4156::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;50&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国重庆市&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a60::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8262::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:330::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4158::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;51&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国四川省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a62::/31*3&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8266::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:398::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:415c::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;52&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国贵州省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a6a::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:826a::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:338::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4162::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;53&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国云南省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a6c::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:826c::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:34c::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4164::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;54&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国西藏区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a7e::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:826e::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:32c::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4168::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;61&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国陕西省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a70::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8270::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:358::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:416a::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;62&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国甘肃省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a74::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8274::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:334::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:416e::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;63&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国青海省&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a78::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8276::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:320::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4170::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;64&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国宁夏区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a7a::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:8278::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:31c::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4172::/31&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;65&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;中国新疆区&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2409:8a7c::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2408:827a::/31&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240e:348::/30&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;240a:4174::/31&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;ul&gt;
  &lt;li&gt;广电电视：暂未开放使用且不开放外网，仅供参考&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;十地方ipv6分配规则&quot;&gt;十、地方IPv6分配规则&lt;/h2&gt;

&lt;p&gt;以贵州省为例，三大运营商的公众宽带和LTE网络均为该规则（海南省有差异）&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;序号&lt;/th&gt;
      &lt;th&gt;区县&lt;/th&gt;
      &lt;th&gt;移动宽带&lt;/th&gt;
      &lt;th&gt;移动LTE&lt;/th&gt;
      &lt;th&gt;联通宽带&lt;/th&gt;
      &lt;th&gt;联通LTE&lt;/th&gt;
      &lt;th&gt;电信宽带&lt;/th&gt;
      &lt;th&gt;电信LTE&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;贵阳市南明区&lt;/td&gt;
      &lt;td&gt;2409:8a6a::/39&lt;/td&gt;
      &lt;td&gt;2409:896a::/39&lt;/td&gt;
      &lt;td&gt;2408:826a::/39&lt;/td&gt;
      &lt;td&gt;2408:846a::/39&lt;/td&gt;
      &lt;td&gt;240e:338::/39&lt;/td&gt;
      &lt;td&gt;240e:438::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;贵阳市云岩区&lt;/td&gt;
      &lt;td&gt;2409:8a6a:200::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:200::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:200::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:200::/39&lt;/td&gt;
      &lt;td&gt;240e:338:200::/39&lt;/td&gt;
      &lt;td&gt;240e:438:200::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;贵阳市花溪区&lt;/td&gt;
      &lt;td&gt;2409:8a6a:400::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:400::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:400::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:400::/39&lt;/td&gt;
      &lt;td&gt;240e:338:400::/39&lt;/td&gt;
      &lt;td&gt;240e:438:400::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;贵阳市乌当区&lt;/td&gt;
      &lt;td&gt;2409:8a6a:600::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:600::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:600::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:600::/39&lt;/td&gt;
      &lt;td&gt;240e:338:600::/39&lt;/td&gt;
      &lt;td&gt;240e:438:600::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;5&lt;/td&gt;
      &lt;td&gt;贵阳市白云区&lt;/td&gt;
      &lt;td&gt;2409:8a6a:800::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:800::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:800::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:800::/39&lt;/td&gt;
      &lt;td&gt;240e:338:800::/39&lt;/td&gt;
      &lt;td&gt;240e:438:800::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;6&lt;/td&gt;
      &lt;td&gt;贵阳市观山湖区&lt;/td&gt;
      &lt;td&gt;2409:8a6a:a00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:a00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:a00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:a00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:a00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:a00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;7&lt;/td&gt;
      &lt;td&gt;贵阳市清镇市&lt;/td&gt;
      &lt;td&gt;2409:8a6a:c00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:c00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:c00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:c00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:c00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:c00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;8&lt;/td&gt;
      &lt;td&gt;贵阳市开阳县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:e00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:e00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:e00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:e00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:e00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:e00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;9&lt;/td&gt;
      &lt;td&gt;贵阳市息烽县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:1000::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:1000::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:1000::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:1000::/39&lt;/td&gt;
      &lt;td&gt;240e:338:1000::/39&lt;/td&gt;
      &lt;td&gt;240e:438:1000::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;10&lt;/td&gt;
      &lt;td&gt;贵阳市修文县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:1200::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:1200::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:1200::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:1200::/39&lt;/td&gt;
      &lt;td&gt;240e:338:1200::/39&lt;/td&gt;
      &lt;td&gt;240e:438:1200::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;11&lt;/td&gt;
      &lt;td&gt;六盘水市钟山区&lt;/td&gt;
      &lt;td&gt;2409:8a6a:1400::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:1400::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:1400::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:1400::/39&lt;/td&gt;
      &lt;td&gt;240e:338:1400::/39&lt;/td&gt;
      &lt;td&gt;240e:438:1400::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;12&lt;/td&gt;
      &lt;td&gt;六盘水市六枝特区&lt;/td&gt;
      &lt;td&gt;2409:8a6a:1600::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:1600::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:1600::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:1600::/39&lt;/td&gt;
      &lt;td&gt;240e:338:1600::/39&lt;/td&gt;
      &lt;td&gt;240e:438:1600::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;13&lt;/td&gt;
      &lt;td&gt;六盘水市水城县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:1800::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:1800::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:1800::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:1800::/39&lt;/td&gt;
      &lt;td&gt;240e:338:1800::/39&lt;/td&gt;
      &lt;td&gt;240e:438:1800::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;14&lt;/td&gt;
      &lt;td&gt;六盘水市盘州市&lt;/td&gt;
      &lt;td&gt;2409:8a6a:1a00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:1a00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:1a00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:1a00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:1a00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:1a00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;15&lt;/td&gt;
      &lt;td&gt;遵义市红花岗区&lt;/td&gt;
      &lt;td&gt;2409:8a6a:1c00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:1c00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:1c00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:1c00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:1c00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:1c00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;16&lt;/td&gt;
      &lt;td&gt;遵义市汇川区&lt;/td&gt;
      &lt;td&gt;2409:8a6a:1e00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:1e00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:1e00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:1e00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:1e00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:1e00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;17&lt;/td&gt;
      &lt;td&gt;遵义市赤水市&lt;/td&gt;
      &lt;td&gt;2409:8a6a:2000::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:2000::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:2000::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:2000::/39&lt;/td&gt;
      &lt;td&gt;240e:338:2000::/39&lt;/td&gt;
      &lt;td&gt;240e:438:2000::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;18&lt;/td&gt;
      &lt;td&gt;遵义市仁怀市&lt;/td&gt;
      &lt;td&gt;2409:8a6a:2200::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:2200::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:2200::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:2200::/39&lt;/td&gt;
      &lt;td&gt;240e:338:2200::/39&lt;/td&gt;
      &lt;td&gt;240e:438:2200::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;19&lt;/td&gt;
      &lt;td&gt;遵义市播州区&lt;/td&gt;
      &lt;td&gt;2409:8a6a:2400::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:2400::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:2400::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:2400::/39&lt;/td&gt;
      &lt;td&gt;240e:338:2400::/39&lt;/td&gt;
      &lt;td&gt;240e:438:2400::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;20&lt;/td&gt;
      &lt;td&gt;遵义市桐梓县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:2600::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:2600::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:2600::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:2600::/39&lt;/td&gt;
      &lt;td&gt;240e:338:2600::/39&lt;/td&gt;
      &lt;td&gt;240e:438:2600::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;21&lt;/td&gt;
      &lt;td&gt;遵义市绥阳县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:2800::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:2800::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:2800::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:2800::/39&lt;/td&gt;
      &lt;td&gt;240e:338:2800::/39&lt;/td&gt;
      &lt;td&gt;240e:438:2800::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;22&lt;/td&gt;
      &lt;td&gt;遵义市正安县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:2a00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:2a00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:2a00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:2a00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:2a00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:2a00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;23&lt;/td&gt;
      &lt;td&gt;遵义市道真县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:2c00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:2c00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:2c00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:2c00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:2c00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:2c00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;24&lt;/td&gt;
      &lt;td&gt;遵义市务川县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:2e00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:2e00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:2e00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:2e00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:2e00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:2e00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;25&lt;/td&gt;
      &lt;td&gt;遵义市凤冈县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:3000::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:3000::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:3000::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:3000::/39&lt;/td&gt;
      &lt;td&gt;240e:338:3000::/39&lt;/td&gt;
      &lt;td&gt;240e:438:3000::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;26&lt;/td&gt;
      &lt;td&gt;遵义市湄潭县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:3200::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:3200::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:3200::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:3200::/39&lt;/td&gt;
      &lt;td&gt;240e:338:3200::/39&lt;/td&gt;
      &lt;td&gt;240e:438:3200::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;27&lt;/td&gt;
      &lt;td&gt;遵义市余庆县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:3400::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:3400::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:3400::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:3400::/39&lt;/td&gt;
      &lt;td&gt;240e:338:3400::/39&lt;/td&gt;
      &lt;td&gt;240e:438:3400::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;28&lt;/td&gt;
      &lt;td&gt;遵义市习水县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:3600::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:3600::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:3600::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:3600::/39&lt;/td&gt;
      &lt;td&gt;240e:338:3600::/39&lt;/td&gt;
      &lt;td&gt;240e:438:3600::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;29&lt;/td&gt;
      &lt;td&gt;铜仁市碧江区&lt;/td&gt;
      &lt;td&gt;2409:8a6a:3800::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:3800::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:3800::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:3800::/39&lt;/td&gt;
      &lt;td&gt;240e:338:3800::/39&lt;/td&gt;
      &lt;td&gt;240e:438:3800::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;30&lt;/td&gt;
      &lt;td&gt;铜仁市万山区&lt;/td&gt;
      &lt;td&gt;2409:8a6a:3a00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:3a00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:3a00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:3a00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:3a00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:3a00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;31&lt;/td&gt;
      &lt;td&gt;铜仁市江口县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:3c00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:3c00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:3c00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:3c00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:3c00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:3c00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;32&lt;/td&gt;
      &lt;td&gt;铜仁市玉屏县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:3e00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:3e00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:3e00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:3e00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:3e00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:3e00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;33&lt;/td&gt;
      &lt;td&gt;铜仁市石阡县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:4000::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:4000::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:4000::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:4000::/39&lt;/td&gt;
      &lt;td&gt;240e:338:4000::/39&lt;/td&gt;
      &lt;td&gt;240e:438:4000::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;34&lt;/td&gt;
      &lt;td&gt;铜仁市思南县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:4200::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:4200::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:4200::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:4200::/39&lt;/td&gt;
      &lt;td&gt;240e:338:4200::/39&lt;/td&gt;
      &lt;td&gt;240e:438:4200::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;35&lt;/td&gt;
      &lt;td&gt;铜仁市印江县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:4400::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:4400::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:4400::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:4400::/39&lt;/td&gt;
      &lt;td&gt;240e:338:4400::/39&lt;/td&gt;
      &lt;td&gt;240e:438:4400::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;36&lt;/td&gt;
      &lt;td&gt;铜仁市德江县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:4600::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:4600::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:4600::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:4600::/39&lt;/td&gt;
      &lt;td&gt;240e:338:4600::/39&lt;/td&gt;
      &lt;td&gt;240e:438:4600::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;37&lt;/td&gt;
      &lt;td&gt;铜仁市沿河县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:4800::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:4800::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:4800::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:4800::/39&lt;/td&gt;
      &lt;td&gt;240e:338:4800::/39&lt;/td&gt;
      &lt;td&gt;240e:438:4800::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;38&lt;/td&gt;
      &lt;td&gt;铜仁市松桃县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:4a00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:4a00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:4a00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:4a00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:4a00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:4a00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;39&lt;/td&gt;
      &lt;td&gt;黔西南州兴义市&lt;/td&gt;
      &lt;td&gt;2409:8a6a:4c00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:4c00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:4c00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:4c00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:4c00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:4c00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;40&lt;/td&gt;
      &lt;td&gt;黔西南州兴仁市&lt;/td&gt;
      &lt;td&gt;2409:8a6a:4e00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:4e00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:4e00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:4e00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:4e00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:4e00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;41&lt;/td&gt;
      &lt;td&gt;黔西南州普安县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:5000::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:5000::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:5000::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:5000::/39&lt;/td&gt;
      &lt;td&gt;240e:338:5000::/39&lt;/td&gt;
      &lt;td&gt;240e:438:5000::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;42&lt;/td&gt;
      &lt;td&gt;黔西南州晴隆县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:5200::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:5200::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:5200::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:5200::/39&lt;/td&gt;
      &lt;td&gt;240e:338:5200::/39&lt;/td&gt;
      &lt;td&gt;240e:438:5200::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;43&lt;/td&gt;
      &lt;td&gt;黔西南州贞丰县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:5400::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:5400::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:5400::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:5400::/39&lt;/td&gt;
      &lt;td&gt;240e:338:5400::/39&lt;/td&gt;
      &lt;td&gt;240e:438:5400::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;44&lt;/td&gt;
      &lt;td&gt;黔西南州望谟县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:5600::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:5600::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:5600::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:5600::/39&lt;/td&gt;
      &lt;td&gt;240e:338:5600::/39&lt;/td&gt;
      &lt;td&gt;240e:438:5600::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;45&lt;/td&gt;
      &lt;td&gt;黔西南州册亨县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:5800::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:5800::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:5800::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:5800::/39&lt;/td&gt;
      &lt;td&gt;240e:338:5800::/39&lt;/td&gt;
      &lt;td&gt;240e:438:5800::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;46&lt;/td&gt;
      &lt;td&gt;黔西南州安龙县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:5a00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:5a00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:5a00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:5a00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:5a00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:5a00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;47&lt;/td&gt;
      &lt;td&gt;毕节市七星关区&lt;/td&gt;
      &lt;td&gt;2409:8a6a:5c00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:5c00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:5c00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:5c00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:5c00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:5c00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;48&lt;/td&gt;
      &lt;td&gt;毕节市大方县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:5e00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:5e00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:5e00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:5e00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:5e00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:5e00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;49&lt;/td&gt;
      &lt;td&gt;毕节市黔西县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:6000::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:6000::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:6000::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:6000::/39&lt;/td&gt;
      &lt;td&gt;240e:338:6000::/39&lt;/td&gt;
      &lt;td&gt;240e:438:6000::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;50&lt;/td&gt;
      &lt;td&gt;毕节市金沙县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:6200::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:6200::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:6200::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:6200::/39&lt;/td&gt;
      &lt;td&gt;240e:338:6200::/39&lt;/td&gt;
      &lt;td&gt;240e:438:6200::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;51&lt;/td&gt;
      &lt;td&gt;毕节市织金县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:6400::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:6400::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:6400::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:6400::/39&lt;/td&gt;
      &lt;td&gt;240e:338:6400::/39&lt;/td&gt;
      &lt;td&gt;240e:438:6400::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;52&lt;/td&gt;
      &lt;td&gt;毕节市纳雍县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:6600::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:6600::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:6600::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:6600::/39&lt;/td&gt;
      &lt;td&gt;240e:338:6600::/39&lt;/td&gt;
      &lt;td&gt;240e:438:6600::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;53&lt;/td&gt;
      &lt;td&gt;毕节市威宁县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:6800::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:6800::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:6800::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:6800::/39&lt;/td&gt;
      &lt;td&gt;240e:338:6800::/39&lt;/td&gt;
      &lt;td&gt;240e:438:6800::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;54&lt;/td&gt;
      &lt;td&gt;毕节市赫章县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:6a00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:6a00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:6a00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:6a00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:6a00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:6a00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;55&lt;/td&gt;
      &lt;td&gt;安顺市西秀区&lt;/td&gt;
      &lt;td&gt;2409:8a6a:6c00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:6c00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:6c00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:6c00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:6c00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:6c00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;56&lt;/td&gt;
      &lt;td&gt;安顺市平坝区&lt;/td&gt;
      &lt;td&gt;2409:8a6a:6e00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:6e00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:6e00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:6e00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:6e00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:6e00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;57&lt;/td&gt;
      &lt;td&gt;安顺市普定县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:7000::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:7000::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:7000::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:7000::/39&lt;/td&gt;
      &lt;td&gt;240e:338:7000::/39&lt;/td&gt;
      &lt;td&gt;240e:438:7000::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;58&lt;/td&gt;
      &lt;td&gt;安顺市镇宁县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:7200::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:7200::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:7200::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:7200::/39&lt;/td&gt;
      &lt;td&gt;240e:338:7200::/39&lt;/td&gt;
      &lt;td&gt;240e:438:7200::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;59&lt;/td&gt;
      &lt;td&gt;安顺市关岭县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:7400::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:7400::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:7400::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:7400::/39&lt;/td&gt;
      &lt;td&gt;240e:338:7400::/39&lt;/td&gt;
      &lt;td&gt;240e:438:7400::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;60&lt;/td&gt;
      &lt;td&gt;安顺市紫云县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:7600::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:7600::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:7600::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:7600::/39&lt;/td&gt;
      &lt;td&gt;240e:338:7600::/39&lt;/td&gt;
      &lt;td&gt;240e:438:7600::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;61&lt;/td&gt;
      &lt;td&gt;黔东南州凯里市&lt;/td&gt;
      &lt;td&gt;2409:8a6a:7800::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:7800::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:7800::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:7800::/39&lt;/td&gt;
      &lt;td&gt;240e:338:7800::/39&lt;/td&gt;
      &lt;td&gt;240e:438:7800::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;62&lt;/td&gt;
      &lt;td&gt;黔东南州黄平县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:7a00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:7a00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:7a00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:7a00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:7a00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:7a00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;63&lt;/td&gt;
      &lt;td&gt;黔东南州施秉县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:7c00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:7c00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:7c00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:7c00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:7c00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:7c00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;64&lt;/td&gt;
      &lt;td&gt;黔东南州三穗县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:7e00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:7e00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:7e00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:7e00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:7e00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:7e00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;65&lt;/td&gt;
      &lt;td&gt;黔东南州镇远县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:8000::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:8000::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:8000::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:8000::/39&lt;/td&gt;
      &lt;td&gt;240e:338:8000::/39&lt;/td&gt;
      &lt;td&gt;240e:438:8000::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;66&lt;/td&gt;
      &lt;td&gt;黔东南州岑巩县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:8200::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:8200::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:8200::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:8200::/39&lt;/td&gt;
      &lt;td&gt;240e:338:8200::/39&lt;/td&gt;
      &lt;td&gt;240e:438:8200::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;67&lt;/td&gt;
      &lt;td&gt;黔东南州天柱县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:8400::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:8400::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:8400::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:8400::/39&lt;/td&gt;
      &lt;td&gt;240e:338:8400::/39&lt;/td&gt;
      &lt;td&gt;240e:438:8400::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;68&lt;/td&gt;
      &lt;td&gt;黔东南州锦屏县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:8600::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:8600::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:8600::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:8600::/39&lt;/td&gt;
      &lt;td&gt;240e:338:8600::/39&lt;/td&gt;
      &lt;td&gt;240e:438:8600::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;69&lt;/td&gt;
      &lt;td&gt;黔东南州剑河县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:8800::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:8800::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:8800::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:8800::/39&lt;/td&gt;
      &lt;td&gt;240e:338:8800::/39&lt;/td&gt;
      &lt;td&gt;240e:438:8800::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;70&lt;/td&gt;
      &lt;td&gt;黔东南州台江县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:8a00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:8a00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:8a00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:8a00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:8a00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:8a00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;71&lt;/td&gt;
      &lt;td&gt;黔东南州黎平县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:8c00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:8c00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:8c00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:8c00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:8c00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:8c00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;72&lt;/td&gt;
      &lt;td&gt;黔东南州榕江县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:8e00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:8e00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:8e00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:8e00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:8e00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:8e00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;73&lt;/td&gt;
      &lt;td&gt;黔东南州从江县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:9000::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:9000::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:9000::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:9000::/39&lt;/td&gt;
      &lt;td&gt;240e:338:9000::/39&lt;/td&gt;
      &lt;td&gt;240e:438:9000::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;74&lt;/td&gt;
      &lt;td&gt;黔东南州雷山县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:9200::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:9200::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:9200::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:9200::/39&lt;/td&gt;
      &lt;td&gt;240e:338:9200::/39&lt;/td&gt;
      &lt;td&gt;240e:438:9200::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;75&lt;/td&gt;
      &lt;td&gt;黔东南州麻江县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:9400::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:9400::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:9400::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:9400::/39&lt;/td&gt;
      &lt;td&gt;240e:338:9400::/39&lt;/td&gt;
      &lt;td&gt;240e:438:9400::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;76&lt;/td&gt;
      &lt;td&gt;黔东南州丹寨县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:9600::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:9600::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:9600::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:9600::/39&lt;/td&gt;
      &lt;td&gt;240e:338:9600::/39&lt;/td&gt;
      &lt;td&gt;240e:438:9600::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;77&lt;/td&gt;
      &lt;td&gt;黔南州都匀市&lt;/td&gt;
      &lt;td&gt;2409:8a6a:9800::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:9800::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:9800::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:9800::/39&lt;/td&gt;
      &lt;td&gt;240e:338:9800::/39&lt;/td&gt;
      &lt;td&gt;240e:438:9800::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;78&lt;/td&gt;
      &lt;td&gt;黔南州福泉市&lt;/td&gt;
      &lt;td&gt;2409:8a6a:9a00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:9a00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:9a00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:9a00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:9a00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:9a00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;79&lt;/td&gt;
      &lt;td&gt;黔南州荔波县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:9c00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:9c00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:9c00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:9c00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:9c00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:9c00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;80&lt;/td&gt;
      &lt;td&gt;黔南州贵定县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:9e00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:9e00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:9e00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:9e00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:9e00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:9e00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;81&lt;/td&gt;
      &lt;td&gt;黔南州瓮安县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:a000::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:a000::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:a000::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:a000::/39&lt;/td&gt;
      &lt;td&gt;240e:338:a000::/39&lt;/td&gt;
      &lt;td&gt;240e:438:a000::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;82&lt;/td&gt;
      &lt;td&gt;黔南州独山县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:a200::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:a200::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:a200::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:a200::/39&lt;/td&gt;
      &lt;td&gt;240e:338:a200::/39&lt;/td&gt;
      &lt;td&gt;240e:438:a200::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;83&lt;/td&gt;
      &lt;td&gt;黔南州平塘县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:a400::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:a400::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:a400::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:a400::/39&lt;/td&gt;
      &lt;td&gt;240e:338:a400::/39&lt;/td&gt;
      &lt;td&gt;240e:438:a400::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;84&lt;/td&gt;
      &lt;td&gt;黔南州罗甸县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:a600::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:a600::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:a600::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:a600::/39&lt;/td&gt;
      &lt;td&gt;240e:338:a600::/39&lt;/td&gt;
      &lt;td&gt;240e:438:a600::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;85&lt;/td&gt;
      &lt;td&gt;黔南州长顺县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:a800::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:a800::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:a800::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:a800::/39&lt;/td&gt;
      &lt;td&gt;240e:338:a800::/39&lt;/td&gt;
      &lt;td&gt;240e:438:a800::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;86&lt;/td&gt;
      &lt;td&gt;黔南州龙里县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:aa00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:aa00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:aa00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:aa00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:aa00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:aa00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;87&lt;/td&gt;
      &lt;td&gt;黔南州惠水县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:ac00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:ac00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:ac00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:ac00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:ac00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:ac00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;88&lt;/td&gt;
      &lt;td&gt;黔南州三都县&lt;/td&gt;
      &lt;td&gt;2409:8a6a:ae00::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:ae00::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:ae00::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:ae00::/39&lt;/td&gt;
      &lt;td&gt;240e:338:ae00::/39&lt;/td&gt;
      &lt;td&gt;240e:438:ae00::/39&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;89&lt;/td&gt;
      &lt;td&gt;贵安新区&lt;/td&gt;
      &lt;td&gt;2409:8a6a:b000::/39&lt;/td&gt;
      &lt;td&gt;2409:896a:b000::/39&lt;/td&gt;
      &lt;td&gt;2408:826a:b000::/39&lt;/td&gt;
      &lt;td&gt;2408:846a:b000::/39&lt;/td&gt;
      &lt;td&gt;240e:338:b000::/39&lt;/td&gt;
      &lt;td&gt;240e:438:b000::/39&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h6 id=&quot;因页面板书有限只能展示部分数据若阁下对本资料感兴趣&quot;&gt;因页面板书有限，只能展示部分数据，若阁下对本资料感兴趣&lt;/h6&gt;

&lt;ul&gt;
  &lt;li&gt;可访问本人博客： https://comeround.cn/article/ipv6-address.html&lt;/li&gt;
  &lt;li&gt;联系本人：linzening@qq.com&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://hello.fe80.cn/pages/ipv6/i6.html&quot;&gt;全国三大运营商IPv6汇总&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;下载三大运营商/教育网Excel地址库文件 &lt;a href=&quot;https://www.kancloud.cn/linzening/mydevops/2210994&quot;&gt;点我下载&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;!-- /public/blog/2021xxx/ipv6xxx-listsxxx.xlsxxxx  --&gt;

&lt;h6 id=&quot;可参考资料&quot;&gt;可参考资料：&lt;/h6&gt;

&lt;p&gt;&lt;a href=&quot;http://ipv6.infosws.cn/20190918/26960.html&quot;&gt;2019上半年中国IPv6市场现状及发展前景&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://ftp.apnic.net/stats/&quot;&gt;全球五大区域性因特网注册管理机构数据&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.cnnic.cn/gywm/xwzx/rdxw/20172017_7056/201912/t20191217_70874.htm&quot;&gt;目前全球IPv4地址分配状态&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;最新下载：http://ftp.apnic.net/stats/apnic/2026/delegated-apnic-20260704.gz&lt;/p&gt;

&lt;style&gt;
@media (min-width: 600px) {
    article {
        width: 150%;
    }
}
@media (min-width: 1600px) {
    article {
        width: 140%;
    }
}
@media (min-width: 2000px) {
    article {
        width: 120%;
    }
}
#other{
    color: #900;
    font-weight: 600;
    cursor: pointer;
}
&lt;/style&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
var table_other = $(&quot;#other&quot;).next();
table_other.hide();
$(&quot;#other&quot;).on(&quot;click&quot;,function(){
    if(table_other.css(&quot;display&quot;) == &quot;none&quot;){
        table_other.fadeIn();
    }else{
        table_other.fadeOut();
    }
});
&lt;/script&gt;

</content>
 </entry>
 
 <entry>
   <title>OpenResty</title>
   <link href="https://comeround.cn/article/openresty.html"/>
   <updated>2019-08-21T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/openresty</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;简介&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;OpenResty® 是一个基于 Nginx 与 Lua 的高性能 Web 平台，其内部集成了大量精良的 Lua 库、第三方模块以及大多数的依赖项。用于方便地搭建能够处理超高并发、扩展性极高的动态 Web 应用、Web 服务和动态网关。最新版：OpenResty 1.15.8.1&lt;/p&gt;

&lt;h2 id=&quot;一安装&quot;&gt;一、安装&lt;/h2&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;yum &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;yum-utils &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;

yum-config-manager &lt;span class=&quot;nt&quot;&gt;--add-repo&lt;/span&gt; https://openresty.org/package/centos/openresty.repo

yum &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;openresty &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;

yum &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;openresty-resty &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;二helloworld&quot;&gt;二、HelloWorld&lt;/h2&gt;

&lt;p&gt;方式1：内嵌lua&lt;/p&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/lua&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;default_type&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;text/html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;content_by_lua&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;ngx.say(&quot;&amp;lt;p&amp;gt;Hello,科帮网&amp;lt;/p&amp;gt;&quot;)&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;方式2：引入lua&lt;/p&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/lua&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;default_type&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;text/html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;content_by_lua_file&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;conf/lua&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;/hello.lua&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;conf/lua/hello.lua&lt;/code&gt;的路径为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/openresty/nginx/conf/lua/hello.lua&lt;/code&gt;，内容为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ngx.say(&quot;hello world&quot;)&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;三redis连接&quot;&gt;三、Redis连接&lt;/h2&gt;

&lt;p&gt;1）首先配置redis，密码为空，redis数据存入任意数据&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;127.0.0.1:6379&amp;gt; set foo &quot;openresty&quot;
OK
127.0.0.1:6379&amp;gt; get foo
&quot;openresty&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;2）配置lua读取redis内容&lt;/p&gt;
&lt;div class=&quot;language-lua highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;redis&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;resty.redis&quot;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cache&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;redis&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;127.0.0.1&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;6379&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;foo&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ngx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;ngx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;say&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;This is Null&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ngx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;say&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;3）配置Nginx引入lua文件&lt;/p&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/redis&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;default_type&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;text/html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;content_by_lua_file&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;conf/lua&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;/redis.lua&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;4）浏览器访问查看效果
&lt;img src=&quot;/public/blog/2019/openresty.redis.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;四代码解读&quot;&gt;四、代码解读&lt;/h2&gt;

&lt;p&gt;1）引入包&lt;/p&gt;

&lt;p&gt;openresty的安装路径为：/usr/local/openresty&lt;/p&gt;

&lt;p&gt;lua库的路径为：/usr/local/openresty/lualib&lt;/p&gt;

&lt;p&gt;当&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;require &quot;resty.redis&quot;&lt;/code&gt;时实际上是引用了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/openresty/lualib/resty/redis.lua&lt;/code&gt;文件&lt;/p&gt;

&lt;p&gt;2）获取HTTP头部&lt;/p&gt;

&lt;div class=&quot;language-lua highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ngx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get_headers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ngx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;say&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;X_FORWARDED_FOR&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;3）获取Nginx的参数&lt;/p&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/lua&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$test&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;hello,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;world.&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;content_by_lua&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;ngx.header.content_type&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;text/plain&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;ngx.say&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;(ngx.var.test)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;local ip = ngx.var.remote_addr
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;4）json转化&lt;/p&gt;

&lt;div class=&quot;language-lua highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cjson&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;cjson&quot;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ngx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get_headers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;json&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cjson&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;输出（格式化后）：&lt;/p&gt;
&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;host&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;134.175.146.38&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;connection&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;keep-alive&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;upgrade-insecure-requests&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;cache-control&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;no-cache&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;pragma&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;no-cache&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;user-agent&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;accept-language&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;zh-CN,zh;q=0.9,en;q=0.8,ja;q=0.7&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;accept-encoding&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;gzip, deflate&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;accept&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;五实验一基于ip统计访问次数&quot;&gt;五、实验一：基于IP统计访问次数&lt;/h2&gt;

&lt;p&gt;1）在Nginx的http里面分配lua的内存空间&lt;/p&gt;

&lt;p&gt;lua_shared_dict limit 10m;&lt;/p&gt;

&lt;div class=&quot;language-lua highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ngx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;binary_remote_addr&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;limit&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ngx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shared&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;limit&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;local&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;limit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;req&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;limit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;incr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;req&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        		&lt;span class=&quot;n&quot;&gt;ngx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;say&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;this ip request over 20 times is: &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;ngx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;say&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;this ip request times : &quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;limit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;ngx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;say&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;this ip first times to request.&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;注意：limit:set(ip,1,10)的意思是设置ip=1，有效期为10秒钟；&lt;/li&gt;
  &lt;li&gt;做cc防攻击可以设置ngx.exit(403)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;实验结果：（注意如果到下一分钟，计数器归零）&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/openresty.limit.gif&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;六实验二geoip的使用&quot;&gt;六、实验二：GeoIP的使用&lt;/h2&gt;

&lt;p&gt;（未完成）&lt;/p&gt;

&lt;hr /&gt;

&lt;blockquote&gt;
  &lt;p&gt;参考文档&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://openresty.org/cn/linux-packages.html#centos&quot;&gt;安装文档&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>《网络工程师》备考指南</title>
   <link href="https://comeround.cn/article/net-tech.html"/>
   <updated>2019-08-18T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/net-tech</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;/public/blog/2019/wangluo-01.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;章节&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;分值&lt;/th&gt;
      &lt;th style=&quot;text-align: left&quot;&gt;重要考点列举&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;计算机硬件基础&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;3~4&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;数据的表示、指令系统、流水线、CPU、Cache、 RAID、内存编址、可靠性&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;操作系统基础&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;1~2&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;进程管理、存储管理、文件管理、设备管理&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;系统开发与项目管理基础&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;3~4&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;软件生命周期、软件开发模型、开发概念、进度管理&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;知识产权和标准化&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;1&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;著作权、保护期限、产权人确立、侵权判断、商标权&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;网络体系结构&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;2&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;网络协议、OSI参考模型、TCP/IP体系结构&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;数据通信基础&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;4~6&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;信道传输速率、调制与编码、常见复用技术和相关标准、差错控制&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;广域网与接入网技术&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;2~3&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;HDLC、PPP、SONET/SDH、xDSL HFC、数据交换类型 IEEE&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;局域网技术&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;6~10&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;802标准、以太网技术、网桥、交换机、无线局域网、VLAN、TRUNK、GVRP、 STP、 综合布线系统、传输介质&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;网络互联与因特网技术&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;20~25&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;IP地址、子网划分、CIDR、 IP数据报、ARP、 ICMP、IPv6协议、TCP、UDP、QOS、路由基础概念、路由器基本配置、RIP、OSPF、BGP、ACL、NAT、Web、DNS、DHCP、FTP、Telnet、 电子邮件&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;系统与网络安全基础&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;5~8&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;计算机病毒、网络攻击、加密算法、密钥管理、数字签名、报文摘要、数字证书、入侵检测技术、安全协议、VPN、 防火墙&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;网络管理技术&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;5~6&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;Windows/Linux网管命令、Linux系统命 令、Linux 目录结构、Linux系统文件、SNMP协议、网络管理概念、网络存储、网络故障排除&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;网络规划和设计&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;3&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;需求分析、通信规范分析、逻辑网络设计、物理网络设计&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;计算机专业英语&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt;5&lt;/td&gt;
      &lt;td style=&quot;text-align: left&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;一存储技术&quot;&gt;一、存储技术&lt;/h2&gt;

&lt;h3 id=&quot;1dasnassan三种存储技术比较&quot;&gt;（1）DAS,NAS,SAN三种存储技术比较&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;NAS-网络附加存储&lt;/li&gt;
  &lt;li&gt;DAS-直接附加存储(Direct Attached Storage),是指将存储设备通过SCSI接口或光纤通道直接连接到一台计算机上。&lt;/li&gt;
  &lt;li&gt;SAN即存储区域网络(Storage Area Network，SAN)。目前有两种类型的SAN，一种是FC SAN(光纤通道的SAN)，一种是IP SAN(以太网的SAN，即现在的iSCSI)。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NAS和SAN本质上的不同点在于NAS有自己的文件系统，而SAN的文件系统在应用程序服务器上而非存储服务器上。这样的不同点导致NAS是文件级别的数据传输，而SAN是基于块级别的传输。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.cnblogs.com/f-ck-need-u/p/9069823.html&quot;&gt;存储基础知识&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;2raid存储技术&quot;&gt;（2）RAID存储技术&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;RAID0：数据分条技术&lt;/li&gt;
  &lt;li&gt;RAID1：镜像冗余&lt;/li&gt;
  &lt;li&gt;RAID3和RAID5都是校验方式，RAID3的校验都放在同一块盘，RAID5为分布式校验，均为只允许坏1块盘&lt;/li&gt;
  &lt;li&gt;RAID6：校验方式，2块冗余盘。允许坏两块盘，是RAID5的升级&lt;/li&gt;
  &lt;li&gt;RAID10：数据分条技术+镜像冗余&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/raid-10-5.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;左图为raid10、右图为raid5&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/raid-6.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.cnblogs.com/WayneZeng/p/3409221.html&quot;&gt;图解RAID0,RAID1,RAID5,RAID10&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;二无线网络技术&quot;&gt;二、无线网络技术&lt;/h2&gt;

&lt;h3 id=&quot;1无线局域网&quot;&gt;（1）无线局域网&lt;/h3&gt;

&lt;p&gt;无线局域网是通过无线信道来实现网络设备之间的通信，并实现通信的移动化、个性化和宽带化。通俗地讲，无线局域网是在不采用网线的情况下，提供以太网互联功能。&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;协议标准&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;WIFI版本&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;工作频段&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;理想速率&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;信道带宽&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;802.11b&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;WiFi1&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2.4GHz&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;11Mbps&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;20MHz&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;802.11a&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;WiFi2&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;5GHz&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;54Mbps&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;20MHz&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;802.11g&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;WiFi3&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2.4GHz&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;54Mbps&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;20MHz&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;802.11n&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;WiFi4&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2.4/5GHz&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;72Mbps(1×1, 20MHz) 150Mbps(1×1, 40MHz) 288Mbps(4×4，20MHz) 600Mbps(4×4, 40MHz)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;20MHz/40MHz(信道绑定)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;802.11ac&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;WiFi5&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;5GHz&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;433Mbps(1×1, 80MHz)867Mbps(1×1,160MHz) 6.77Gbps(8×8,160MHz)&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;40MHz/80MHz/160MHz&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;802.11ax&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;WiFi6&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2.4/5GHz&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt; &lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;160MHz&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/wifi-version.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;2数据通信技术&quot;&gt;（2）数据通信技术&lt;/h3&gt;

&lt;p&gt;1）电信号在电缆上的传输速度大约是200 000km/s，调制延迟626ms&lt;/p&gt;

&lt;p&gt;2）卫星传输延迟大约270ms&lt;/p&gt;

&lt;h3 id=&quot;3无线加密技术&quot;&gt;（3）无线加密技术&lt;/h3&gt;

&lt;p&gt;最常用的加密方式有：WEP（共享秘钥）、WPA/WPA2、WPA-PSK/WPA2-PSK，最安全的是后者，使用了TKIP、AES算法&lt;/p&gt;

&lt;h2 id=&quot;3计算机网络&quot;&gt;（3）计算机网络&lt;/h2&gt;

&lt;h3 id=&quot;osi七层模型&quot;&gt;OSI七层模型&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;OSI中的层&lt;/th&gt;
      &lt;th&gt;功能&lt;/th&gt;
      &lt;th&gt;TCP/IP协议族&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;应用层&lt;/td&gt;
      &lt;td&gt;文件传输，电子邮件，文件服务，虚拟终端&lt;/td&gt;
      &lt;td&gt;TFTP，HTTP，SNMP，FTP，SMTP，DNS，Telnet&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;表示层&lt;/td&gt;
      &lt;td&gt;数据格式化，代码转换，数据加密&lt;/td&gt;
      &lt;td&gt;没有协议&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;会话层&lt;/td&gt;
      &lt;td&gt;解除或建立与别的接点的联系&lt;/td&gt;
      &lt;td&gt;没有协议&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;传输层&lt;/td&gt;
      &lt;td&gt;提供端对端的接口&lt;/td&gt;
      &lt;td&gt;TCP，UDP&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;网络层&lt;/td&gt;
      &lt;td&gt;为数据包选择路由&lt;/td&gt;
      &lt;td&gt;IP，ICMP，RIP，OSPF，BGP，IGMP&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;数据链路层&lt;/td&gt;
      &lt;td&gt;传输有地址的帧以及错误检测功能&lt;/td&gt;
      &lt;td&gt;SLIP，CSLIP，PPP，ARP，RARP，MTU&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;物理层&lt;/td&gt;
      &lt;td&gt;以二进制数据形式在物理媒体上传输数据&lt;/td&gt;
      &lt;td&gt;ISO2110，IEEE802，IEEE802.2&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;局域网&quot;&gt;局域网&lt;/h3&gt;

&lt;h4 id=&quot;以太网预备知识&quot;&gt;以太网预备知识&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;10BASE-T：”10″ 代表传输速率为 10Mbps，”Base” 代表” 基带传输”，”T” 代表双绞线，使用星形拓扑结构，&lt;/li&gt;
  &lt;li&gt;100BASE-T4：”4″ 代表 4 对 3、4、5 类非屏蔽双绞线或屏蔽双绞线，最大传送距离是 100 米，使用星形拓扑结构，&lt;/li&gt;
  &lt;li&gt;100BASE-TX：”100″ 代表传输速率为 100Mbps，”Base” 代表” 基带传输”，”T” 代表双绞线，使用星形拓扑结构，&lt;/li&gt;
  &lt;li&gt;100BASE-FX：”F” 代表光纤， IEEE 标准为 802.3u。 100Base-FX 运行于光缆上，使得它非常适合于骨干和长距离传输。&lt;/li&gt;
  &lt;li&gt;10Base2 电缆，” 细以太网（thin ethernet）” 电缆，与” 粗以太网” 相对，支持的有效长度为 200 米。&lt;/li&gt;
  &lt;li&gt;10Base5 电缆，” 粗以太网（thick ethernet）” 电缆，802.3 标准建议为黄色，支持的有效长度为 500 米。&lt;/li&gt;
  &lt;li&gt;100Base-T 是一种以 100Mbps 速率工作的局域网（LAN）标准，它通常被称为快速以太网标准，并使用 UTP（非屏蔽双绞线）铜质电缆。 快速以太网 : 与 10BASE-T 的区别在于网络速率是 10BASE-T 的十倍，即 100M。&lt;/li&gt;
  &lt;li&gt;100Base-T4 是一个 4 对线系统，但是它采用半双工传输模式，传输媒体采用 3 类、4 类、5 类无屏蔽双绞线 UTP 的 4 对线路进行 100Mbps 的数据传输。超五类+ 网线百兆的只要 1—2，3—6 四芯线即可，对应：橙白、橙、绿白、绿；六类网线千兆 8 芯都需要。&lt;/li&gt;
  &lt;li&gt;100Base-TX 使用的传输介质与 10Base-T 一样都是双绞线。但是由于传输信号的频率较高，需要使用较高的质量的双绞线，通常为 UTP-5 类或匹配电阻为 150Ω的 STP（屏蔽双绞线），使用 UTP-5 时最大传输距离为 100M。&lt;/li&gt;
  &lt;li&gt;100Base-FX 使用光纤作为传输介质，传输距离与所使用的光纤类型及连接方式有关。在 100 Base FX 环境中，一般选用 62.5/125μm 多模光缆，也可选用 50/125，85/125 以及 100/125 的光缆。但在一个完整的光缆段上必须选择同种型号的光缆，以免引起光信号不必要的损耗。对于多模光缆，在 100Mbps 传输率，在点对点的连接方式和全双工的情况下，系统中最长的媒体段可达 2km。100 Base FX 也支持单模光缆作为媒体，在全双工情况下，单模光缆段可达到 40km，甚至更远，但价格要比多模光缆贵得多。在系统配置时，可以外置单模光缆收发器，也可以在多模光缆收发器的连接器上再配置一个多模/单模转换器，以驱动单模光缆。光纤接口仍然采用 MIC、ST 或 SC 光纤接口。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;tcpip协议族&quot;&gt;TCP/IP协议族&lt;/h3&gt;

&lt;h4 id=&quot;udp无连接的不可靠的&quot;&gt;UDP:无连接的，不可靠的&lt;/h4&gt;

&lt;p&gt;UDP 是一种轻量级的运输协议，它仅提供最小服务。UDP是无连接的，不可靠的。&lt;/p&gt;

&lt;p&gt;UDP头部占8字节，源端口、目的端口、长度、校验和。&lt;/p&gt;

&lt;h4 id=&quot;tcp&quot;&gt;TCP&lt;/h4&gt;

&lt;p&gt;面向连接的、可靠的、流投递服务。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;头部内容：源端口16位、目的端口16位、发送顺序号SYN 32位，接收顺序号ACK 32位等共20字节。&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;icmp&quot;&gt;ICMP&lt;/h4&gt;

&lt;p&gt;ICMP是IP协议的附属协议，属于网络层协议&lt;/p&gt;

&lt;h4 id=&quot;arp&quot;&gt;ARP&lt;/h4&gt;

&lt;p&gt;地址解析协议，通过目标IP，查询目标主机的MAC，实现IP与MAC的映射。【ARP可以看作是第二层和第三层之间的协议】&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;RARP，反向地址解析，将MAC转换成IP地址。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;ip说&quot;&gt;IP说&lt;/h3&gt;

&lt;h4 id=&quot;ipv4地址分类&quot;&gt;IPv4地址分类：&lt;/h4&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;网络类型&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;最大网络数&lt;/th&gt;
      &lt;th&gt;IP 地址范围&lt;/th&gt;
      &lt;th&gt;最大主机数&lt;/th&gt;
      &lt;th&gt;私有 IP 地址范围&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;A&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;126(2^7-2)&lt;/td&gt;
      &lt;td&gt;1.0.0.0--126.255.255.255&lt;/td&gt;
      &lt;td&gt;2^24-2&lt;/td&gt;
      &lt;td&gt;10.0.0.0--10.255.255.255&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;B&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;16384(2^14)&lt;/td&gt;
      &lt;td&gt;128.0.0.0--191.255.255.255&lt;/td&gt;
      &lt;td&gt;2^16-2&lt;/td&gt;
      &lt;td&gt;172.16.0.0--172.31.255.255&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;C&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2097152(2^21)&lt;/td&gt;
      &lt;td&gt;192.0.0.0--223.255.255.255&lt;/td&gt;
      &lt;td&gt;2^8-2&lt;/td&gt;
      &lt;td&gt;192.168.0.0--192.168.255.255&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;a href=&quot;https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml&quot;&gt;IPv4专用地址注册表&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;D类地址：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;224.0.0.1：指本地子网的所有主机构成的组播组。&lt;/li&gt;
  &lt;li&gt;224.0.0.2：指所有路由器构成的组播组。&lt;/li&gt;
  &lt;li&gt;224.0.0.5：指代在任意网络中所有运行OSPF进程的接口都属于该组，于是接收所有224.0.0.5的组播数据包。&lt;/li&gt;
  &lt;li&gt;224.0.0.6：指代一个多路访问网络中DR和BDR的组播接收地址&lt;/li&gt;
  &lt;li&gt;224.0.0.9：RIPv2&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href=&quot;https://www.iana.org/assignments/multicast-addresses/multicast-addresses.xhtml&quot;&gt;D类地址控制块&lt;/a&gt;&lt;/p&gt;

&lt;h4 id=&quot;ipv6详见ipv6笔记&quot;&gt;IPv6详见：【IPv6笔记】&lt;/h4&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/wangluo-ipv6-server.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;dhcp分配ip过程&quot;&gt;DHCP分配IP过程&lt;/h3&gt;

&lt;p&gt;服务器使用UDP67端口，客户端使用UDP68端口。&lt;/p&gt;

&lt;p&gt;（1）DHCPdiscover&lt;/p&gt;

&lt;p&gt;客户机向网络中广播DHCPdiscover数据包；原地址0.0.0.0，目的地址255.255.255.255（源端口68，目的端口67）&lt;/p&gt;

&lt;p&gt;（2）DHCP服务器收到DHCPdiscover数据包，通过广播DHCPoffer数据包做出响应，包含IP、MAC、租约期。&lt;/p&gt;

&lt;p&gt;（3）客户机收到第一个包做出响应，发送DHCPrequest数据包，告诉DHCP服务器需要使用哪个IP，并发送ARP&lt;/p&gt;

&lt;p&gt;（4）DHCPack&lt;/p&gt;

&lt;p&gt;租约期过一半时，通过发送request包续租原来的IP。租约期过87.5%时，重新发送dhcpdiscover广播包重新获取新的IP。租约期默认为8天。&lt;/p&gt;

&lt;h3 id=&quot;dns域名系统&quot;&gt;DNS域名系统&lt;/h3&gt;

&lt;p&gt;SOA：DNS数据库的来源&lt;/p&gt;

&lt;p&gt;PTR查询：&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dig -x 203.119.25.1 @114.114.114.114&lt;/code&gt; 得到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1.25.119.203.in-addr.arpa. 37 IN PTR a.dns.cn.&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;C:\Users\user&amp;gt;nslookup
默认服务器:  UnKnown
Address:  fe80::1

&amp;gt; set type=ptr
&amp;gt; 203.119.25.1
服务器:  UnKnown
Address:  fe80::1

非权威应答:
1.25.119.203.in-addr.arpa       name = a.dns.cn
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;解析顺序：本地DNS缓存、Hosts表、本地DNS服务器、根域名、顶级域名、权威服务器&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.iana.org/domains/root/db&quot;&gt;根域名数据库&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.iana.org/domains/root/servers&quot;&gt;根服务器数据库&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4&quot;&gt;DNS记录类型&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;http&quot;&gt;HTTP&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;请求方式：GET、POST、HEAD、PUT、DELETE、OPTIONS、TRACE、CONNECT&lt;/li&gt;
  &lt;li&gt;状态码：
    &lt;ul&gt;
      &lt;li&gt;101协议转换&lt;/li&gt;
      &lt;li&gt;206响应部分&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;HTTP版本
    &lt;ul&gt;
      &lt;li&gt;HTTP/0.9
        &lt;ul&gt;
          &lt;li&gt;仅支持GET，仅能请求访问HTML格式的资源&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;HTTP/1.0
        &lt;ul&gt;
          &lt;li&gt;包含头消息&lt;/li&gt;
          &lt;li&gt;Content-Type可以支持多种数据格式&lt;/li&gt;
          &lt;li&gt;POST和HEAD&lt;/li&gt;
          &lt;li&gt;每次TCP连接只能发送一个请求，不支持keepalive&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;HTTP/1.1
        &lt;ul&gt;
          &lt;li&gt;持久连接：TCP可以被多个请求复用，大多数浏览器允许同域名同时建立6个持久连接&lt;/li&gt;
          &lt;li&gt;服务器只有处理完一个回应，才会进行下一个回应&lt;/li&gt;
          &lt;li&gt;新增了请求方式PUT、PATCH、OPTIONS、DELETE等&lt;/li&gt;
          &lt;li&gt;新增了Host字段，因此虚拟主机得以发展&lt;/li&gt;
          &lt;li&gt;支持文件断点续传，Accept-Ranges: bytes&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;HTTP/2
        &lt;ul&gt;
          &lt;li&gt;增加双工模式，即不仅客户端能够同时发送多个请求，服务端也能同时处理多个请求，解决了队头堵塞的问题&lt;/li&gt;
          &lt;li&gt;多路复用的技术，做到同一个连接并发处理多个请求，而且并发请求的数量比HTTP1.1大了好几个数量级&lt;/li&gt;
          &lt;li&gt;二进制协议&lt;/li&gt;
          &lt;li&gt;头信息压缩机制：头信息使用gzip或compress压缩后再发送，根据头部生成一个索引号，以后就不发送同样字段了，只发送索引号&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;ftp&quot;&gt;FTP&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;lcd：进入本地客户端指定的目录&lt;/li&gt;
  &lt;li&gt;!cd：&lt;/li&gt;
  &lt;li&gt;dir：&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;smtp&quot;&gt;SMTP&lt;/h3&gt;

&lt;h3 id=&quot;常用端口&quot;&gt;常用端口&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;应用层协议&lt;/th&gt;
      &lt;th&gt;传输层协议&lt;/th&gt;
      &lt;th&gt;端口号&lt;/th&gt;
      &lt;th&gt;协议描述&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;FTP&lt;/td&gt;
      &lt;td&gt;TCP&lt;/td&gt;
      &lt;td&gt;20、21&lt;/td&gt;
      &lt;td&gt;文件传输协议，20控制端口，21数据端口&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;SSH&lt;/td&gt;
      &lt;td&gt;TCP&lt;/td&gt;
      &lt;td&gt;22&lt;/td&gt;
      &lt;td&gt;安全shell协议&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Telnet&lt;/td&gt;
      &lt;td&gt;TCP&lt;/td&gt;
      &lt;td&gt;23&lt;/td&gt;
      &lt;td&gt;远程登录协议，传输非加密，能不用则不用&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;DNS&lt;/td&gt;
      &lt;td&gt;TCP/UDP&lt;/td&gt;
      &lt;td&gt;53&lt;/td&gt;
      &lt;td&gt;域名系统，解析使用UDP、复制使用TCP&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;HTTP&lt;/td&gt;
      &lt;td&gt;TCP&lt;/td&gt;
      &lt;td&gt;80&lt;/td&gt;
      &lt;td&gt;超文本传输协议&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;SMTP&lt;/td&gt;
      &lt;td&gt;TCP&lt;/td&gt;
      &lt;td&gt;25&lt;/td&gt;
      &lt;td&gt;简单邮件传输协议&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;POP3&lt;/td&gt;
      &lt;td&gt;TCP&lt;/td&gt;
      &lt;td&gt;110&lt;/td&gt;
      &lt;td&gt;邮局协议3代&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;DHCP&lt;/td&gt;
      &lt;td&gt;UDP&lt;/td&gt;
      &lt;td&gt;67/68&lt;/td&gt;
      &lt;td&gt;IP动态分配，客户端使用68，服务端使用67&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;TFTP&lt;/td&gt;
      &lt;td&gt;UDP&lt;/td&gt;
      &lt;td&gt;69&lt;/td&gt;
      &lt;td&gt;简单文件传输协议&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;HTTPS&lt;/td&gt;
      &lt;td&gt;TCP&lt;/td&gt;
      &lt;td&gt;443&lt;/td&gt;
      &lt;td&gt;安全http&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;BGP4&lt;/td&gt;
      &lt;td&gt;TCP&lt;/td&gt;
      &lt;td&gt;179&lt;/td&gt;
      &lt;td&gt;边界网关协议的应用&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;SNMP&lt;/td&gt;
      &lt;td&gt;UDP&lt;/td&gt;
      &lt;td&gt;161/162&lt;/td&gt;
      &lt;td&gt;简单网络管理协议&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Win&lt;/td&gt;
      &lt;td&gt;TCP&lt;/td&gt;
      &lt;td&gt;3389&lt;/td&gt;
      &lt;td&gt;Windows远程桌面&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Proxy&lt;/td&gt;
      &lt;td&gt;TCP&lt;/td&gt;
      &lt;td&gt;8080&lt;/td&gt;
      &lt;td&gt;代理端口&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;blockquote&gt;
  &lt;p&gt;更多端口资料请访问 &lt;a href=&quot;https://tool.oschina.net/commons?type=7#famous_&quot;&gt;常用端口对照表&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;协议头部整理 &lt;a href=&quot;/public/blog/2021/TCP-IP-Header.xlsx&quot;&gt;点我下载&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;4网络安全&quot;&gt;（4）网络安全&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;对称加密：加密秘钥和解密秘钥相同，DES、三重DES、AES
    &lt;ul&gt;
      &lt;li&gt;三重DES：使用两个秘钥，执行三次DES算法。第一层和第三层相同，112位&lt;/li&gt;
      &lt;li&gt;AES：高级加密标准，微信小程序加密传输就是用这个加密算法的&lt;/li&gt;
      &lt;li&gt;RC2、RC4、RC5：适合对大量明文进行加密传输&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;非对称加密：加密秘钥和解密秘钥不相同，RSA、ECC
    &lt;ul&gt;
      &lt;li&gt;RSA：1024位的RSA密钥基本安全，2048位的密钥极其安全。&lt;/li&gt;
      &lt;li&gt;ECC：椭圆曲线密码编码&lt;/li&gt;
      &lt;li&gt;PGP：邮件加密技术&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;摘要算法：MD5、SHA、HMAC
    &lt;ul&gt;
      &lt;li&gt;MD5：一种被广泛使用的密码散列函数，可以产生出一个128位的散列值&lt;/li&gt;
      &lt;li&gt;SHA：SHA家族的五个算法，分别是SHA-1、SHA-224、SHA-256、SHA-384，和SHA-512。SHA1输出160位、SHA256输出256位。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;网络认证：
    &lt;ul&gt;
      &lt;li&gt;Kerberos：网络认证协议，提供认证服务&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;网络攻击：DDos、SQL注入、SYN攻击
    &lt;ul&gt;
      &lt;li&gt;ARP欺骗攻击：通过欺骗局域网内访问者PC的网关MAC地址，使访问者PC错以为攻击者更改后的MAC地址是网关的MAC，导致网络不通。&lt;/li&gt;
      &lt;li&gt;DNS欺骗：首先欺骗者向目标机器发送构造好的ARP应答数据包，ARP欺骗成功后，嗅探到对方发出的DNS请求数据包，分析数据包取得ID和端口号后，向目标发送自己构造好的一个DNS返回包，对方收到DNS应答包后，发现ID和端口号全部正确，即把返回数据包中的域名和对应的IP地址保存进DNS缓存表中，而后来的当真实的DNS应答包返回时则被丢弃。&lt;/li&gt;
      &lt;li&gt;DoS：拒绝服务攻击 SYN Flood&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;入侵检测
    &lt;ul&gt;
      &lt;li&gt;IDS&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;5路由协议&quot;&gt;（5）路由协议&lt;/h2&gt;

&lt;h3 id=&quot;自治系统as&quot;&gt;自治系统AS&lt;/h3&gt;

&lt;h3 id=&quot;内部网关协议&quot;&gt;内部网关协议&lt;/h3&gt;

&lt;h4 id=&quot;rip-路由信息协议&quot;&gt;RIP 路由信息协议&lt;/h4&gt;

&lt;h4 id=&quot;ospf-开放最短路径优先&quot;&gt;OSPF 开放最短路径优先&lt;/h4&gt;

&lt;h3 id=&quot;外部网关协议egp&quot;&gt;外部网关协议EGP&lt;/h3&gt;

&lt;h4 id=&quot;边界网关协议bgp&quot;&gt;边界网关协议BGP&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;open：type=1，发送报文&lt;/li&gt;
  &lt;li&gt;update：type=2，用于通告路由。&lt;/li&gt;
  &lt;li&gt;notification：type=3，有错则回复3&lt;/li&gt;
  &lt;li&gt;keepalive：type=4，可以建立连接则回复4&lt;/li&gt;
  &lt;li&gt;refresh：type=5&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;路由器技术&quot;&gt;路由器技术&lt;/h3&gt;

&lt;h5 id=&quot;nat-网络地址转换&quot;&gt;NAT 网络地址转换&lt;/h5&gt;

&lt;h5 id=&quot;cidr-无分类域间路由&quot;&gt;CIDR 无分类域间路由&lt;/h5&gt;

&lt;blockquote&gt;
  &lt;p&gt;网关协议原文链接：https://blog.csdn.net/u010603798/article/details/86689291&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;6系统及服务器&quot;&gt;（6）系统及服务器&lt;/h2&gt;

&lt;h4 id=&quot;windows系统&quot;&gt;Windows系统&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;ipconfig
    &lt;ul&gt;
      &lt;li&gt;ipconfig/all：显示本机TCP/IP配置的详细信息；&lt;/li&gt;
      &lt;li&gt;ipconfig/release：DHCP客户端手工释放IP地址；&lt;/li&gt;
      &lt;li&gt;ipconfig/renew：DHCP客户端手工向服务器刷新请求；&lt;/li&gt;
      &lt;li&gt;ipconfig/flushdns：清除本地DNS缓存内容；&lt;/li&gt;
      &lt;li&gt;ipconfig/displaydns：显示本地DNS内容；&lt;/li&gt;
      &lt;li&gt;ipconfig/registerdns：手工注册DNS；&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;ping
    &lt;ul&gt;
      &lt;li&gt;批量ping网段：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;for /L %D in (1,1,255) do ping 192.168.1.%D&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;设置发送包数：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ping 114.114.114.114 -n 5&lt;/code&gt;&lt;/li&gt;
      &lt;li&gt;解析IPv6地址：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ping ayouleyang.cn -6&lt;/code&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;tracert：路由跟踪&lt;/li&gt;
  &lt;li&gt;netstat
    &lt;ul&gt;
      &lt;li&gt;-a：显示所有端口&lt;/li&gt;
      &lt;li&gt;-e：显示以太网统计信息&lt;/li&gt;
      &lt;li&gt;-n：以数字形式显示地址和端口号&lt;/li&gt;
      &lt;li&gt;-r：显示路由表（=route print）&lt;/li&gt;
      &lt;li&gt;-s：显示统计信息&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;arp
    &lt;ul&gt;
      &lt;li&gt;-a：显示所有MAC&lt;/li&gt;
      &lt;li&gt;-s ip mac：手动设置arp&lt;/li&gt;
      &lt;li&gt;-d ip：删除一个arp&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;linux系统&quot;&gt;Linux系统&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;路径规则
    &lt;ul&gt;
      &lt;li&gt;/home：除root的家目录&lt;/li&gt;
      &lt;li&gt;/etc：系统配置&lt;/li&gt;
      &lt;li&gt;/lib：核心模块共享库&lt;/li&gt;
      &lt;li&gt;/dev：设备文件&lt;/li&gt;
      &lt;li&gt;/usr：程序目录&lt;/li&gt;
      &lt;li&gt;/mnt：外部设备挂载点&lt;/li&gt;
      &lt;li&gt;/proc：存放内存读取进程信息&lt;/li&gt;
      &lt;li&gt;/var：其他&lt;/li&gt;
      &lt;li&gt;账号记在：/etc/passwd&lt;/li&gt;
      &lt;li&gt;密码记在：/etc/shadow&lt;/li&gt;
      &lt;li&gt;用户组：/etc/group&lt;/li&gt;
      &lt;li&gt;用户组密码：/etc/gshadow&lt;/li&gt;
      &lt;li&gt;/etc/hosts：IP地址的主机映射&lt;/li&gt;
      &lt;li&gt;/etc/host.conf：解析主域名方法&lt;/li&gt;
      &lt;li&gt;/etc/resolv.conf：配置DNS&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;文件权限：drwxrwx— d表示文件类型，r表示可读，w表示可写，x表示可执行
    &lt;ul&gt;
      &lt;li&gt;r-4，w-2，x-1：&lt;/li&gt;
      &lt;li&gt;从左到右：用户权限，用户组权限，其他用户组权限&lt;/li&gt;
      &lt;li&gt;chmod g+rwx filename #与文件所有者同组用户增加权限&lt;/li&gt;
      &lt;li&gt;chmod a+rwx filename #&lt;/li&gt;
      &lt;li&gt;chmod u+rwx filename #文件所有者&lt;/li&gt;
      &lt;li&gt;chmod o+rwx filename&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;常用命令
    &lt;ul&gt;
      &lt;li&gt;cd 改变目录&lt;/li&gt;
      &lt;li&gt;pwd 显示当前目录&lt;/li&gt;
      &lt;li&gt;mkdir 创建目录 -p多级目录&lt;/li&gt;
      &lt;li&gt;ls 查看 -a 包括隐藏 -l 详细格式&lt;/li&gt;
      &lt;li&gt;cp 复制&lt;/li&gt;
      &lt;li&gt;rm 删除&lt;/li&gt;
      &lt;li&gt;mv 移动&lt;/li&gt;
      &lt;li&gt;cat 获取&lt;/li&gt;
      &lt;li&gt;ps 显示进程&lt;/li&gt;
      &lt;li&gt;tac 倒序显示&lt;/li&gt;
      &lt;li&gt;more 一页一页的显示&lt;/li&gt;
      &lt;li&gt;less 可向前向后&lt;/li&gt;
      &lt;li&gt;vim 编辑文件&lt;/li&gt;
      &lt;li&gt;kill 终止进程&lt;/li&gt;
      &lt;li&gt;tar 打包&lt;/li&gt;
      &lt;li&gt;whereis 查找文件位置&lt;/li&gt;
      &lt;li&gt;grep 搜索内容&lt;/li&gt;
      &lt;li&gt;ln 创建链接&lt;/li&gt;
      &lt;li&gt;ifconfig
        &lt;ul&gt;
          &lt;li&gt;-a 查看某个网卡&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;用户命令
    &lt;ul&gt;
      &lt;li&gt;useradd&lt;/li&gt;
      &lt;li&gt;userdel&lt;/li&gt;
      &lt;li&gt;passwd&lt;/li&gt;
      &lt;li&gt;groupadd&lt;/li&gt;
      &lt;li&gt;groupdel&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;windows系统和linux系统的命令差异&quot;&gt;Windows系统和Linux系统的命令差异&lt;/h4&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;简述&lt;/th&gt;
      &lt;th&gt;Windows&lt;/th&gt;
      &lt;th&gt;Linux&lt;/th&gt;
      &lt;th&gt;说明&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;文件列表&lt;/td&gt;
      &lt;td&gt;dir&lt;/td&gt;
      &lt;td&gt;ls&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;复制文件&lt;/td&gt;
      &lt;td&gt;cp&lt;/td&gt;
      &lt;td&gt;cp&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;移动文件&lt;/td&gt;
      &lt;td&gt;move&lt;/td&gt;
      &lt;td&gt;mv&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;获取文件&lt;/td&gt;
      &lt;td&gt;type&lt;/td&gt;
      &lt;td&gt;cat&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;路由跟踪&lt;/td&gt;
      &lt;td&gt;tracert&lt;/td&gt;
      &lt;td&gt;traceroute&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;查看IP配置&lt;/td&gt;
      &lt;td&gt;ipconfig&lt;/td&gt;
      &lt;td&gt;ifconfig&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;ping&lt;/td&gt;
      &lt;td&gt;ping&lt;/td&gt;
      &lt;td&gt;ping&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;nslookup&lt;/td&gt;
      &lt;td&gt;nslookup&lt;/td&gt;
      &lt;td&gt;nslookup&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;dig&lt;/td&gt;
      &lt;td&gt;dig&lt;/td&gt;
      &lt;td&gt;dig&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;7华为交换机路由器命令&quot;&gt;（7）华为交换机/路由器命令&lt;/h2&gt;

&lt;h3 id=&quot;dhcp服务器配置&quot;&gt;DHCP服务器配置&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;2019年5月：配置路由器Router1，网关为192.168.100.1&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[Huawei] dhcp enable (启用dhcp服务器)
[Huawei] interface vlanif 123 (配置vlan123)
[Huawei-Vlanif123] dhcp select global (全局)
[Huawei-Vlanif123] quit
[Huawei] ip pool lan
[Huawei-ip-pool-lan] gateway-list 192.168.100.1 (配置网关)
[Huawei-ip-pool-lan] network 192.168.100.0 mask 24 (配置局域网IP)
[Huawei-ip-pool-lan] quit
[Huawei]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;交换机配置&quot;&gt;交换机配置&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;2019年下半年真题：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;某企业的网络结构如图4-1所示。完成交换机的基本配置，请根据描述，将以下配置代码补充完整。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/wangluo-1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;Huawei&amp;gt; _system-view_
[Huawei] _sysname_ Switch
[Switch] _interface_ GigabitEthernet0/0/1
[Switch-GigabitEthernet0/0/1] port link-type _(5:trunk)_
[Switch-GigabitEthernet0/0/1] port trunk allow-pass vlan_(6:10)_
[Switch-GigabitEthernet0/0/1] quit
[Huawei] interface vlanif 10
[Switch-Vlanif10] ip address 10.10.1.1 255.255.255.0
[Switch-Vlanif10] quit
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;按照公司规定，禁止市场部和研发部工作日每天8:00~18:00访问公司视频服务器，其他部门和用户不受此限制。请根据描述，将以下配置代码补充完整。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[Switch] _(7:time-range)_ satimc 8:00 to 18:00 working-day
[Switch] acl 3002
[Switch-acl-adv-3002] rule deny ip source 10.10.2.0.0.0.0.255 destination 10.10.20.1 0.0.0.0 timc-range satime
[Switch] acl 3003
[Switch-acl-adv-3003] rule deny ip source 10.10.3.0.0.0.0.255 destination 10.10.20.1 0.0.0.0 timc-range satime
[Switch] quit

[Switch] traffic classifier c_market //_(8:创建一个c_market的流分类)_
[Switch-classifier-c_market] _(9:if-match)_ acl 3002 //将ACL与流分类关联
[Switch-classifier-c_market] quit

[Switch] traffic classifier c_rd
[Switch-classifier-c_rd] if-match acl 3003 //将ACL与流分类关联
[Switch-classifier-c_rd] quit

[Switch] _(10:traffic behavior)_b market //创建流行为
[Switch-behavior-b market] _(11:deny)_ //配置流行为动作为拒绝报文通过
[Switch-behavior-b market] quit

[Switch] traffic behavior b_rd
[Switch-behavior-b_rd] deny
[Switch-behavior-b_rd] quit

[Switch] _(12)_p_market //创建流策略
[Switch-trafficpolicy-p_market] classifier c_market behavior b_market
[Switch-trafficpolicy-p_market] quit

[Switch] traffic policy p_rd //创建流策略
[Switch-trafficpolicy-p_rd] classifier c_rd behavior b_rd
[Switch-trafficpolicy-p_rd] quit

[Switch] interface _(13)_
[Switch-GigabitEthernet0/0/2] traffic-policy p_market _(13)_
[Switch-GigabitEthernet0/0/2] quit

[Switch] interface GigabitEthernet 0/0/3
[Switch-GigabitEthernet0/0/3] traffic-policy _(14)_ inbound
[Switch-GigabitEthernet0/0/3] quit
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;交换机：2018-11&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;HUAWEI&amp;gt; system-view
[HUAWEI] sysname Switch3 //交换机名称命令为Switch3
[Switch3] vlan batch 10 20 // 批量创建vlan
[Switch3] interface GigabitEthernet 0/0/3
[Switch3-GigabitEthernet0/0/3] port link-type trunk //连接核心交换机的是trunk，连接PC端的是access
[Switch3-GigabitEthernet0/0/3] port trunk allow-pass vlan 10 20 //允许vlan10 20通过
[Switch3-GigabitEthernet0/0/3] quit
[Switch3] interface GigabitEthernet 0/0/1
[Switch3-GigabiEthernet0/0/1] port link-type access // 连接PC端的是access模式
[Switch3-GigabitEthernet0/0/1] port default vlan 10 // 下连：默认允许vlan10通过
[Switch3-GigabitEthernet/0/1] quit


&amp;lt;HUAWEI&amp;gt; system-view
[HUAWEI] sysname Switch1
[Switchl] vlan batch (5)
[Switch1] interface GigabitEthernet/0/1
[Switchl-GigabitEthernetO/0/1] port link-type trunk
[Switchl-GigabitEthernet0/0/1] port trunk allow-pass (6)
[Switch1 -GigabitEthernetO/0/1] quit
[Switch1] interface vlanif 10
[Switch1-Vlanif10] ip address 192.168.10.1 24
[Switch1-Vlanif10] quit
[Switch1] interface vlanif 20
[Switch1 -Vlanif20] ip address 192.168.20.1 24
[Switch1 -Vlanif20] quit
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;静态路由实现网络互通配置，Switch1和Router1&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[Switchl] ip route-static (9) //默认优先级
[Switchl] ip route-static 0.0.0.0 0.0.0.0 172.16.30.2(默认下一跳地址) preference 70
[Router] ip route-static (10:202.1.111.1) //默认优先级
[Router] ip route-static 192.168.10.0 255.255.255.0 172.16.10.1
[Router] ip route-static 192.168. 10.0 255.255.255.0 172.16.20.1 preference 7O
[Router] ip route-static 192.168.20.0 255.255.255.0 172.16.10.1
[Router] ip route-static 192.168.20.0 255.255.255.0 172.16.20.1 preference 70
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;配置nat&quot;&gt;配置NAT&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[Huawei] acl number 3002
[Huawei-acl-adv-3002] rule 5 permit ip source 192.168.100.0 0.0.0.255 (允许源IP访问)
[Huawei-acl-adv-3002] quit
[Huawei] interface virtual-template 10 (创建虚拟接口模板10)
[Huawei-virtual-template 10] ip address ppp-negotiate
[Huawei-virtual-template 10] nat outbound 3002 (NAT出口流量匹配3002ACL)
[Huawei-virtual-template 10] quit
[Huawei]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h6 id=&quot;路由交换配置总结&quot;&gt;路由交换配置总结&lt;/h6&gt;

&lt;p&gt;（1）port link-type 后面的可以为trunk、hybrid、access。&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Access类型的端口只能属于1个VLAN，一般用于连接计算机的端口；&lt;/li&gt;
  &lt;li&gt;Trunk类型的端口可以允许多个VLAN通过，可以接收和发送多个VLAN的报文，一般用于交换机之间连接的端口；&lt;/li&gt;
  &lt;li&gt;Hybrid类型的端口可以允许多个VLAN通过，可以接收和发送多个VLAN的报文，可以用于交换机之间连接，也可以用于连接用户的计算机。&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h6 id=&quot;其他笔记&quot;&gt;其他笔记&lt;/h6&gt;

&lt;p&gt;DMZ区域：两个防火墙之间的区域，又称隔离区，主要存放着一些公共服务器（DNS服务器、Web服务器）&lt;/p&gt;

&lt;p&gt;IPS入侵防御系统：IPS技术可以深度感知并检测流经的数据流量，对恶意报文进行丢弃以阻断攻击，对滥用报文进行限流以保护网络带宽资源。&lt;/p&gt;

&lt;p style=&quot;background-color:rgba(197, 227, 211, 0.34);&quot;&gt;
	&lt;span style=&quot;display: inline-block;
    width: 50px;
    height: 50px;
    vertical-align: top;
    overflow: hidden;
    border-radius: 0% 100px 100px 0%;
    border-width: 0px;
    border-style: none;
    border-color: rgb(62, 62, 62);
    background-color: rgb(111, 186, 131);color:#fff;
	font-weight:600;
	padding:12px;&quot;&gt;
完
	&lt;/span&gt;
	&lt;span style=&quot;color:rgb(83, 118, 105);padding:8px;display:inline-block;font-size:20px;&quot;&gt;
		学习文档
	&lt;/span&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.csdn.net/passionkk/article/details/100538418&quot;&gt;为什么MTU值普遍都是1500&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s/hh61cpqAImKBpcU6aKdK7Q&quot;&gt;计算机网络基础知识总结&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://learnku.com/articles/22104&quot;&gt;网络基础&lt;/a&gt;：https://learnku.com/articles/22104&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.51cto.com/9821049/2136711&quot;&gt;华为路由器命令大全&lt;/a&gt;：https://blog.51cto.com/9821049/2136711&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://hexingxing.cn/10base-t%E3%80%81100base-t4%E3%80%81100base-tx%E3%80%81100base-fx/&quot;&gt;浅入理解 10BASE-T、100BASE-T4、100BASE-TX、100BASE-FX&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://zhuanlan.zhihu.com/p/138235610&quot;&gt;IP基础知识全家桶&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>CDN技术浅谈</title>
   <link href="https://comeround.cn/article/cdn-tech-note.html"/>
   <updated>2019-08-16T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/cdn-tech-note</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;为什么要使用CDN？&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;       网络已经成为生活中必不可少的一部分，无论是清早手机翻看的新闻八卦，还是公交地铁里刷的停不下来的短视频，又或是你闲逛的购物网站，热追的电视剧，都与 CDN 有着密不可分的联系。无论你在互联网上做什么，或者消费什么类型的内容，其实每个文本字符、每一帧图像背后都会有 CDN 的助力。&lt;/p&gt;

&lt;p&gt;       CDN（Content Delivery Network，即内容分发网络）主要通过将访问内容缓存在边缘节点，缩短用户与网站的距离，来提高站点渲染速度和性能。很显然，CDN 发挥的作用主要由边缘节点来呈现，边缘节点作为用户与源站的桥梁，其实不仅仅只起到加速的作用，同时还可以作为恶意访问的“屏障”。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/cdn.jpg&quot; alt=&quot;CDN架构图&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/cdn-x-01.png&quot; alt=&quot;CDN架构图&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;一cdn访问控制&quot;&gt;一、CDN访问控制&lt;/h2&gt;

&lt;h3 id=&quot;ip黑白名单&quot;&gt;IP黑白名单&lt;/h3&gt;

&lt;p&gt;由于某些行业竞争激烈，因此常常会遇到一些竞争对手利用恶意 IP 占用网站资源，影响网站访问。为了能够保护站点数据和流量负载，需要网站运营者对这些恶意 IP 进行屏蔽。&lt;/p&gt;

&lt;p&gt;若需要禁止某些 IP 或只允许某些 IP 访问，可以使用 IP 黑白名单功能。并且在同一时间内，CDN只支持生效一种规则，比如：要么禁止某些 IP 访问，要么允许某些 IP 访问。支持 * 通配符，如 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;10.11.12.*&lt;/code&gt;，将禁止或只允许&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;10.11.12.0 ~ 10.11.12.255&lt;/code&gt;范围的 IP 访问。&lt;/p&gt;

&lt;h3 id=&quot;地区访问限制&quot;&gt;地区访问限制&lt;/h3&gt;

&lt;p&gt;地区访问限制是指根据加速网站的需求，允许或禁止特定区域的终端用户对网站资源的访问。即网站指定地区，允许该地区终端用户访问，而限制其他地区用户访问，或者相反。&lt;/p&gt;

&lt;h3 id=&quot;防盗链&quot;&gt;防盗链&lt;/h3&gt;

&lt;p&gt;在讲防盗链之前，先来了解一下什么是盗链。&lt;/p&gt;

&lt;p&gt;盗链是指服务提供商自己不提供服务的内容，通过技术手段绕过其它有利益的最终用户界面（如广告），直接在自己的网站上向终端用户提供其它服务提供商的服务内容，骗取最终用户的浏览和点击率。&lt;/p&gt;

&lt;p&gt;简单来说，就是其他网站上“盗”用了你网站的资源，去增加他的网站点击率，但最后流量却算在你身上，让你花“冤枉钱”。这个当然不能忍！怎么办？由于各网站性质不同（游戏/新闻等），需求也是不尽相同的。&lt;/p&gt;

&lt;h3 id=&quot;referer防盗链&quot;&gt;Referer防盗链&lt;/h3&gt;

&lt;p&gt;最常用的防盗链手段，就是通过对 HTTP 请求中的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Referer Header&lt;/code&gt;进行判断，来决定用户是否可以访问该资源。&lt;/p&gt;

&lt;p&gt;白名单：仅允许名单中的域名网站访问文件，其他域名网站都不允许访问。&lt;/p&gt;

&lt;p&gt;黑名单：仅禁止名单中的域名网站访问文件，其他域名网站都允许访问。&lt;/p&gt;

&lt;p&gt;Referer 为空：若禁止即不允许用户直接访问该资源，因为直接在浏览器的地址栏中输入一个资源的 URL 地址，请求是不会包含 Referer 字段的。&lt;/p&gt;

&lt;h3 id=&quot;user-agent防盗链&quot;&gt;User-Agent防盗链&lt;/h3&gt;

&lt;p&gt;HTTP 请求 Header 中的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;User-Agent&lt;/code&gt;字段，是一段浏览器或者设备标识的字符串。对于网站本身来说，有时需要让一些资源只能在某些浏览器或者设备上才能访问。&lt;/p&gt;

&lt;p&gt;CDN 支持针对 HTTP 请求头中的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;User-Agent&lt;/code&gt;信息，禁止或者允许符合特定&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;User-Agent&lt;/code&gt;规则的请求。具体的使用场景例如：某客户端拥有自己专属的客户端对资源进行下载，该下载工具在请求时，使用了定制的&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;User-Agent&lt;/code&gt;名称，或只允许此类&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;User-Agent&lt;/code&gt;请求资源，此时可以配置&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;User-Agent&lt;/code&gt;白名单就可以实现。&lt;/p&gt;

&lt;h3 id=&quot;token防盗链&quot;&gt;Token防盗链&lt;/h3&gt;

&lt;p&gt;Token 防盗链是提供时效性访问的。通过设置访问密钥和过期时间来达到加密文件的目的。只有按照算法成功计算出 Token 才能进行访问。比如网站有些内容，希望付费才能访问，且规定访问有有效期，就可以通过 Token 防盗链来实现。&lt;/p&gt;

&lt;h3 id=&quot;回源鉴权&quot;&gt;回源鉴权&lt;/h3&gt;

&lt;p&gt;如果不希望对方知晓你的防盗链规则原理，或者 CDN 无法满足的特殊防盗链需求，也许也需适合你的防盗链选择就是回源鉴权了。&lt;/p&gt;

&lt;p&gt;回源鉴权是一种高级的防盗链方式，需要在源站配置一台鉴权服务器，并设置鉴权方式。之后 CDN 边缘节点每次接受到请求之后，都会回用户源站的鉴权服务器进行验证，验证通过之后才认为是合法请求，CDN 才会继续提供服务。&lt;/p&gt;

&lt;p&gt;回源鉴权适用于对防盗链有很高实时性要求的场景，当然因为每次请求都需要鉴权服务器的验证，在开启该功能时也需要考虑到访问量过大时鉴权服务器的压力。&lt;/p&gt;

&lt;h3 id=&quot;ip访问限制&quot;&gt;IP访问限制&lt;/h3&gt;

&lt;p&gt;可以针对单个 IP 在单位周期时间内的访问频率设置一定的阈值，将超过该阈值的 IP 的访问进行直接拦截，从而达到访问限制的目的。&lt;/p&gt;

&lt;p&gt;当前的单 IP 访问频率只支持针对 CDN 单个边缘节点生效，当达到设定的阈值时，异常访问的客户端 IP 将加入黑名单中，并可以设定生效时间，在该时间周期内，所有该 IP 的访问都会被拦截。&lt;/p&gt;

&lt;h3 id=&quot;浏览器缓存配置&quot;&gt;浏览器缓存配置&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Cache-Control: max-age=600
Expires: Tue, 24 Aug 2021 06:58:41 GMT
Date: Tue, 24 Aug 2021 06:48:41 GMT
Last-Modified: Thu, 12 Aug 2021 12:42:42 GMT
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;cc防护&quot;&gt;CC防护&lt;/h3&gt;

&lt;p&gt;攻击一直都是让网站管理者头疼的问题，特别面对恶意的 DDoS 攻击时。CC 攻击（Challenge Collapsar）是 DDoS的一种，也是一种常见的网站攻击方法，攻击者通过代理服务器或者肉鸡向受害网站不停地发大量数据包，造成对方服务器资源耗尽，一直到宕机崩溃。&lt;/p&gt;

&lt;p&gt;CC 防护主要是针对 CC 攻击的一种应用层攻击防护，该功能通过自定义匹配规则对目标资源进行监控，当请求频率达到触发频率时，对疑似攻击请求进行校验，校验通过则允许访问；校验不通过，则直接禁止访问。&lt;/p&gt;

&lt;h3 id=&quot;cors跨域共享&quot;&gt;CORS跨域共享&lt;/h3&gt;

&lt;p&gt;基于业务场景添加 HTTP 头部，包括 HTTP 请求头和 HTTP 响应头，例如：添加跨域配置。具体规则描述如下：&lt;/p&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if（&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$_HOST&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;www.example.com）&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kn&quot;&gt;ADD_Response_Header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Access-Control-Allow-Origin&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;*&quot;&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;刷新预热&quot;&gt;刷新预热&lt;/h3&gt;

&lt;p&gt;全站加速提供资源的刷新和预热功能。通过刷新功能，可以强制全站加速节点回源并获取最新文件；通过预热功能可以在业务高峰之前预热热门资源，提高资源访问效率。&lt;/p&gt;

&lt;h3 id=&quot;反向代理中的ip传递&quot;&gt;反向代理中的IP传递&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[&quot;HTTP_X_REAL_IP&quot;] =&amp;gt; string(31) &quot;2409:896a:31:bc6a:2:1:7447:a924&quot;
[&quot;HTTP_X_EDGE_RETRY_TIMES&quot;] =&amp;gt; string(1) &quot;-&quot;
[&quot;HTTP_X_FORWARDED_FOR&quot;] =&amp;gt; string(31) &quot;2409:896a:31:bc6a:2:1:7447:a924&quot;
[&quot;HTTP_X_REQUEST_ID&quot;] =&amp;gt; string(32) &quot;5b16d20b4133036df1a1e272c116caf8&quot;
[&quot;HTTP_CLIENT_IP&quot;] =&amp;gt; string(31) &quot;2409:896a:31:bc6a:2:1:7447:a924&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;应用服务器收到的是&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[&quot;x-real-ip&quot;] =&amp;gt; string(31) &quot;2409:896a:31:bc6a:2:1:7447:a924&quot;
[&quot;x-forwarded-for&quot;] =&amp;gt; string(31) &quot;2409:896a:31:bc6a:2:1:7447:a924&quot;
[&quot;x-request-id&quot;] =&amp;gt; string(32) &quot;5b16d20b4133036df1a1e272c116caf8&quot;
[&quot;client-ip&quot;] =&amp;gt; string(31) &quot;2409:896a:31:bc6a:2:1:7447:a924&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;二cdn常用头部控制&quot;&gt;二、CDN常用头部控制&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;If-Match：如果对象的 ETag 没有改变，其实也就意味著对象没有改变，才执行请求的动作。&lt;/li&gt;
  &lt;li&gt;If-None-Match：如果对象的 ETag 改变了，其实也就意味著对象也改变了，才执行请求的动作。&lt;/li&gt;
  &lt;li&gt;If-Modified-Since：如果请求的对象在该头部指定的时间之后修改了，才执行请求的动作（比如返回对象），否则返回代码304，告诉浏览器 该对象没有修改。例如：If-Modified-Since：Thu, 10 Apr 2008 09:14:42 GMT&lt;/li&gt;
  &lt;li&gt;If-Unmodified-Since：如果请求的对象在该头部指定的时间之后没修改过，才执行请求的动作（比如返回对象）。&lt;/li&gt;
  &lt;li&gt;If-Range：浏览器告诉 WEB 服务器，如果我请求的对象没有改变，就把我缺少的部分给我，如果对象改变了，就把整个对象给我。浏览器通过发送请求对象的 ETag 或者 自己所知道的最后修改时间给 WEB 服务器，让其判断对象是否改变了。总是跟 Range 头部一起使用。&lt;/li&gt;
  &lt;li&gt;Last-Modified：WEB 服务器认为对象的最后修改时间，比如文件的最后修改时间，动态页面的最后产生时间等等。例如：Last-Modified：Tue, 06 May 2008 02:42:43 GMT&lt;/li&gt;
  &lt;li&gt;Location：WEB 服务器告诉浏览器，试图访问的对象已经被移到别的位置了，到该头部指定的位置去取。例如：Location：http://i0.sinaimg.cn/dy/deco/2008/0528/sinahome_0803_ws_005_text_0.gif&amp;lt;/a&amp;gt;&lt;/li&gt;
  &lt;li&gt;Pramga：主要使用 Pramga: no-cache，相当于 Cache-Control： no-cache。例如：Pragma：no-cache&lt;/li&gt;
  &lt;li&gt;Proxy-Authenticate： 代理服务器响应浏览器，要求其提供代理身份验证信息。Proxy-Authorization：浏览器响应代理服务器的身份验证请求，提供自己的身份信息。&lt;/li&gt;
  &lt;li&gt;Range：浏览器（比如 Flashget 多线程下载时）告诉 WEB 服务器自己想取对象的哪部分。例如：Range: bytes=1173546-&lt;/li&gt;
  &lt;li&gt;Referer：浏览器向 WEB 服务器表明自己是从哪个 网页/URL 获得/点击 当前请求中的网址/URL。例如：Referer：http://www.sina.com/&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;三dns解析&quot;&gt;三、DNS解析&lt;/h2&gt;

&lt;h4 id=&quot;1dns服务器类型&quot;&gt;（1）DNS服务器类型&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;权威DNS&lt;/strong&gt; 指域名在域名注册商处所设置的 DNS 服务器地址。该地址决定了该域名的解析管理权（新增，删除，修改等）。比如DNSPod的权威服务器：*.dnspod.net, *.dnsv3.com等。当域名设置权威服务器并设置了解析记录后，客户端请求域名时，权威服务器将返回该域名的对应的解析记录信息。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;LocalDNS&lt;/strong&gt; 是DNS查询中的第一个节点。Local DNS作为客户端与 DNS 域名服务器的中间人。客户端发送DNS查询时，Local DNS将使用缓存的数据进行响应，或者将向根域名服务器发送请求，接着向根域名服务器发送另一个请求，然后向权威DNS发送最后一个请求。收到来自包含已请求 IP地址的权威DNS服务器的响应后，Local DNS将向客户端发送响应。
在此过程中，Local DNS将缓存从权威DNS服务器收到的信息。当一个客户端请求的域名IP地址是另一个客户端最近请求的IP地址时，Local DNS 可绕过与域名服务器进行通信的过程，并仅从第二个客户端的缓存中为第一个客户端提供所请求的记录。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;公共DNS&lt;/strong&gt; 指面向所有互联网用户的全球公共递归域名解析服务。和仅使用本地LocalDNS的传统解析服务相比，公共解析服务，一般具备更加“快速”、“稳定”、“安全”互联网访问。&lt;/p&gt;

&lt;h4 id=&quot;2mx和cname解析记录冲突问题&quot;&gt;（2）MX和CNAME解析记录冲突问题&lt;/h4&gt;

&lt;p&gt;在递归进行解析查询时，各记录类型之间是有优先级的，所以在主机记录相同、解析线路相同的情况下，有几种记录类型不能共存使用，否则会给用户造成配置风险，导致业务不可用的情况发生。&lt;/p&gt;

&lt;p&gt;以下拿CNAME记录和MX记录的冲突来举例：假设为come.com配置如下两条记录&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;记录类型 主机记录 记录值
MX @ mx1.hichina.com
CNAME @ www.liaocheng.co
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;结论&lt;/strong&gt;
按照RFC标准协议CNAME优先级最高，所以在解析请求过程中，会优先返回CNAME解析记录结果，这样设置的结果导致用户无法请求到MX记录，直接对客户的邮箱业务造成使用影响。所以对于这类情况，云解析DNS会通过记录冲突的提示方式，来帮助用户避免这种配置风险。&lt;/p&gt;

&lt;p&gt;解析冲突解决办法
1：最简单的办法就是，可以通过使用URL转发记录来解析CNAME记录和MX记录冲突问题，这个种办法少有DNS服务商可以免费提供，不想花钱继续下边看其他的办法。
2：使用A记录代替CNAME，然后在服务器上做301跳转。
3: 使用二级域名做MX记录。&lt;/p&gt;

&lt;h2 id=&quot;四cdn常用计费方式&quot;&gt;四、CDN常用计费方式&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;流量计费&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;适用于域名流量曲线波动较大，且有带宽尖峰的用户。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;峰值带宽计费&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;适用于域名稳定的业务流量曲线比较平稳。&lt;/p&gt;

&lt;h2 id=&quot;五cdn服务商&quot;&gt;五、CDN服务商&lt;/h2&gt;

&lt;h4 id=&quot;国外&quot;&gt;国外&lt;/h4&gt;

&lt;p&gt;CloudFlare、Akamai&lt;/p&gt;

&lt;h4 id=&quot;国内&quot;&gt;国内&lt;/h4&gt;

&lt;p&gt;阿里云、腾讯云、百度智能云、百度云加速、网宿、蓝汛、白山云、又拍云、七牛云、青云、猫云、多吉云&lt;/p&gt;

&lt;hr /&gt;

&lt;h6 id=&quot;参考文献&quot;&gt;参考文献&lt;/h6&gt;

&lt;p&gt;&lt;a href=&quot;https://www.upyun.com/tech/article/410/CDN%20访问控制的那些事.html&quot;&gt;CDN访问控制的那些事&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MjM5ODc5ODgyMw==&amp;amp;mid=2653583687&amp;amp;idx=1&amp;amp;sn=5d4b03897481f2fd240b5821d3fcbb1b&amp;amp;chksm=bd1bedcf8a6c64d991b647e0ecf4177d66d2262d006d7de8ffde82086a528035a8d92bc18272&amp;amp;mpshare=1&amp;amp;scene=1&amp;amp;srcid=0921oJf8lG3pd0u85HQ38DJn&amp;amp;sharer_sharetime=1600688803272&amp;amp;sharer_shareid=37ee1a4098b78fb47058be76f609635d&amp;amp;key=7f54b3443b68303342f86742c4e09d9cd53d64f13b2a101f560261251743e11e1b46eb946995cdfe60b6dee555f88da8db4ab688ae24029a73649b70d66a41e8c28723f6cbca55fb8adedc2fd321b045cc5c7aa07ef9196370623e41cb0b12b728f943ea5ebe3a60f74d3406bcaa287005a2c170d2dcecbb0da4f5b40ca7c37a&amp;amp;ascene=1&amp;amp;uin=MTgwNDM3NzYxOA%3D%3D&amp;amp;devicetype=Windows+10+x64&amp;amp;version=62090529&amp;amp;lang=zh_CN&amp;amp;exportkey=A0i8gNvB0hmk1UK38KSK7ik%3D&amp;amp;pass_ticket=olZAdJkF%2BbptducGeniiMmY98gsiZd2m0NkhNohDCE5NEiPjvKTN3QqR4NsZUNkJ&amp;amp;wx_header=0&quot;&gt;如何选择适合自己网站的防盗链&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://juejin.cn/post/7002781373014474759&quot;&gt;高性能利器：CDN我建议你好好学一下！&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Hexo静态博客</title>
   <link href="https://comeround.cn/article/use-by-hexo.html"/>
   <updated>2019-08-14T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/use-by-hexo</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;我曾经花了很久试用Hugo，但没能部署成功&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Hexo是一个基于Node.js的博客系统。&lt;/p&gt;

&lt;h2 id=&quot;1npm安装hexo&quot;&gt;（1）npm安装hexo：&lt;/h2&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm install -g hexo-cli&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;2配置文件&quot;&gt;（2）配置文件：&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;deploy:
  type: git
  repo:
    coding: https://git.coding.net/linzening/hexo.git
  branch: master
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;注：部署的时候，直接推送到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;linzening/hexo&lt;/code&gt;的master分支，并且会被覆盖，所以原代码可以放到其他分支，master为生成之后的分支，两个分支的记录完全不同。&lt;/p&gt;

&lt;p&gt;安装部署依赖：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;npm install hexo-deployer-git --save
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;3清除生成部署&quot;&gt;（3）清除、生成、部署：&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;hexo clean;hexo g;hexo d
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;4主题&quot;&gt;（4）主题&lt;/h2&gt;

&lt;p&gt;https://github.com/iJinxin/hexo-theme-sky&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;npm install
npm install hexo-renderer-scss --save
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;总结：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;实际上，服务器部署hexo的也就是直接部署静态文件，我原本以为服务器会自己执行&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hexo g&lt;/code&gt;部署。相比之下，jekyll是能在服务器端生成静态文件部署的&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;参考：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;（1）&lt;a href=&quot;https://blog.csdn.net/nightmare_dimple/article/details/86661465&quot;&gt;利用Hexo将博客部署到GitPages和CodingPages&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>腾讯云COS使用笔记</title>
   <link href="https://comeround.cn/article/tencent-cos-note.html"/>
   <updated>2019-08-06T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/tencent-cos-note</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;这篇文章，主要是用腾讯云COS和阿里云OSS做对比，选择更适合自己的方案&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;1阿里云对象存储遗留的问题&quot;&gt;（1）阿里云对象存储遗留的问题&lt;/h2&gt;

&lt;p&gt;1）如何方便快速的把整个站点上传到OSS，并且文件目录结构不变。&lt;/p&gt;

&lt;p&gt;2）如何在浏览器端直接使用JavaScript调用对象存储接口，使得可以直接在Web上上传文件到对象存储服务器，而不需要经过服务端中转。&lt;/p&gt;

&lt;p&gt;3）如何在浏览器中使用JavaScript调用对象存储的接口，直接显示存储中的图片或下载文件。&lt;/p&gt;

&lt;p&gt;这样，基本上是把对象存储当成一个文件服务器，方便上传、管理、下载、查看文件目录。但在阿里云对象存储中，能使用JavaScript的有&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Node.js&lt;/code&gt;、&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Browser.js&lt;/code&gt;，但均需要npm安装或打包，不易于浏览器端直接使用。&lt;/p&gt;

&lt;h2 id=&quot;2腾讯云cos操作笔记&quot;&gt;（2）腾讯云COS操作笔记&lt;/h2&gt;

&lt;h3 id=&quot;1上传文件夹&quot;&gt;1）上传文件夹&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/cos.tencent.uploadfolder.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;2javascript上传对象&quot;&gt;2）JavaScript上传对象&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/h3&gt;

&lt;p&gt;首先，得做一个sts授权接口，提供给js端调用，该接口是基于ThinkPHP5框架编写的&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$sts&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;\STS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 配置参数&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&apos;url&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;https://sts.tencentcloudapi.com/&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&apos;domain&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;sts.tencentcloudapi.com&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&apos;proxy&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&apos;secretId&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;xxxxxxxxxxxxxxxxxxx&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 固定密钥&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&apos;secretKey&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;xxxxxxxxxxxxxxxx&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 固定密钥&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&apos;bucket&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;cq-xxxxxxx&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 换成你的 bucket&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&apos;region&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;ap-chongqing&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 换成 bucket 所在园区&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&apos;durationSeconds&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 密钥有效期&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&apos;allowPrefix&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;*&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 这里改成允许的路径前缀，可以根据自己网站的用户登录态判断允许上传的目录，例子：* 或者 a/* 或者 a.jpg&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 密钥的权限列表。简单上传和分片需要以下的权限，其他权限列表请看 https://cloud.tencent.com/document/product/436/31923&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&apos;allowActions&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// 所有 action 请看文档 https://cloud.tencent.com/document/product/436/31923&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// 简单上传&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;name/cos:PutObject&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;name/cos:PostObject&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// 分片上传&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;name/cos:InitiateMultipartUpload&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;name/cos:ListMultipartUploads&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;name/cos:ListParts&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;name/cos:UploadPart&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;name/cos:CompleteMultipartUpload&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// 获取列表&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;name/cos:GetBucket&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 获取临时密钥，计算签名&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$tempKeys&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$sts&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getTempKeys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 返回数据给前端&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;Content-Type: application/json&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;Access-Control-Allow-Origin:*&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;Access-Control-Allow-Headers: origin,accept,content-type&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$tempKeys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;js端先获取该接口参数，经过授权后，才可上传文件&lt;/p&gt;

&lt;p&gt;HTML关键代码&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;file-selector&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;file&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Bucket&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;cq-xxxx&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Region&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;ap-chongqing&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 初始化实例&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cos&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;COS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;getAuthorization&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;https://xxxx.cn/sts.html&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;xhr&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;XMLHttpRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;xhr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;GET&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;xhr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onload&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;responseText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;nf&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
                &lt;span class=&quot;na&quot;&gt;TmpSecretId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;credentials&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;credentials&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;tmpSecretId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                &lt;span class=&quot;na&quot;&gt;TmpSecretKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;credentials&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;credentials&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;tmpSecretKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                &lt;span class=&quot;na&quot;&gt;XCosSecurityToken&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;credentials&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;credentials&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sessionToken&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                &lt;span class=&quot;na&quot;&gt;ExpiredTime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;expiredTime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;xhr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// 监听选文件&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;file-selector&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onchange&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;files&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// 小文件上传&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;cos&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;putObject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;Bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;Region&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Region&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;Key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;images/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;StorageClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;STANDARD&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;Body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 上传文件对象&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;onProgress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;progressData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;progressData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;3使用layui的上传控件上传文件-关键代码&quot;&gt;3）使用LayUI的上传控件上传文件 关键代码&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;//绑定文件域&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;upload&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;elem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#test1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;exts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;jpg|png|gif|bmp|jpeg&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;auto&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4096&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;choose&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
        &lt;span class=&quot;cm&quot;&gt;/**
         * index 得到文件索引
         * file 得到文件对象
         * result 得到文件base64编码，比如图片
         */&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;obj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;preview&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;cos&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;putObject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
                &lt;span class=&quot;na&quot;&gt;Bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                &lt;span class=&quot;na&quot;&gt;Region&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Region&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                &lt;span class=&quot;na&quot;&gt;Key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;images/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                &lt;span class=&quot;na&quot;&gt;StorageClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;STANDARD&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                &lt;span class=&quot;na&quot;&gt;Body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                &lt;span class=&quot;na&quot;&gt;onProgress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;progressData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;progressData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
                    &lt;span class=&quot;nx&quot;&gt;element&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;progress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;demo&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;progressData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;percent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;toFixed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;statusCode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
                    &lt;span class=&quot;nx&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;上传成功&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;icon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
                    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                    &lt;span class=&quot;nx&quot;&gt;layer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;上传失败&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;icon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;效果图：&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/cos.upload.layui.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;4获取文件列表及下载文件&quot;&gt;4）获取文件列表及下载文件&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;filedomain&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;http://cq.file.cos.com&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;renderList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;il&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;imglist&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_html&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;il&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;_html&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;img src=&quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;filedomain&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;il&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Key&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;innerHTML&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;cos&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getBucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;Bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;Region&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Region&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;Prefix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;images/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 这里传入列出的文件前缀&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;function &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;err&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Contents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Contents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;nf&quot;&gt;renderList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Contents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;        
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;5实现效果&quot;&gt;5）实现效果&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://hello.fe80.cn/pages/store/cos/upload.html&quot;&gt;http://hello.fe80.cn/pages/store/cos/upload.html&lt;/a&gt;，不保证长期维护&lt;/p&gt;

&lt;h3 id=&quot;6腾讯云对象存储支持ipv6方案-20210731&quot;&gt;6）腾讯云对象存储支持IPv6方案 2021/07/31&lt;/h3&gt;

&lt;p&gt;目前只有北京、上海、广州、南京地域COS支持IPv6直接访问。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;*.cos-dualstack.ap-beijing.myqcloud.com.[2402:4e00:21:1008::9]
*.cos-dualstack.ap-shanghai.myqcloud.com.[2402:4e00:32:1000::55]
*.cos-dualstack.ap-guangzhou.myqcloud.com.[2402:4e00:40:2::20]
*.cos-dualstack.ap-nanjing.myqcloud.com.[2402:4e00:a0:1b::58]
*.cos-dualstack.ap-chongqing.myqcloud.com.
*.cos-dualstack.ap-chengdu.myqcloud.com.
*.cos-dualstack.ap-hongkong.myqcloud.com.
*.cos-dualstack.ap-singapore.myqcloud.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://cloud.tencent.com/developer/article/1561701&quot;&gt;使用IPV6和IPV4双栈域名访问COS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;遇到问题：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;（1）获取文件列表时，总是出现403状态码，后面检查为sts没有授权，需要修改PHP代码对获取文件列表GetBucket授权。&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$sts&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;\STS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 配置参数&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// ...&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&apos;allowActions&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// 所有 action 请看文档 https://cloud.tencent.com/document/product/436/31923&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// ...&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// 获取列表&lt;/span&gt;
        &lt;span class=&quot;s1&quot;&gt;&apos;name/cos:GetBucket&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 获取临时密钥，计算签名&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$tempKeys&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$sts&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getTempKeys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;总结：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;（1）对比阿里OSS来说，腾讯COS作为文件（图片）服务器来说更为方便，主要为COS可以使用JavaScript方便的获取文件列表及下载文件，阿里的较为麻烦（需要使用后端语言再调用接口，暂时没实现功能）。&lt;/p&gt;

&lt;p&gt;（2）经测试：从贵州贵阳到百度云存储香港节点访问时延为72ms，速度为500KB/s；到阿里云香港节点云存储IPV6网络时延电信为300±ms/移动为120±ms，访问速度较慢；到腾讯云香港节点云存储访问为46ms，速度为3MB/s以上。故：若域名没有备案，需要部署静态网站，使用腾讯云存储访问效果最佳。[2021/06/07]&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;参考文档：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://cloud.tencent.com/document/product/436/11459&quot;&gt;JavaScriptSDK快速入门&lt;/a&gt; &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>DNS解析过程</title>
   <link href="https://comeround.cn/article/dns-tcpdump.html"/>
   <updated>2019-07-22T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/dns-tcpdump</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;背景：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;DNS解析有很多疑问，比如说：localDNS是怎么知道根域名服务器IP的；cn.的NS记录为a.dns.cn.，这样不就造成死循环了吗；根域名服务器返回的是一个域名，然后，我又要怎么去查询？&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;笔记&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;〇基本知识&quot;&gt;（〇）基本知识&lt;/h2&gt;

&lt;p&gt;（1）域名类型&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://help.aliyun.com/knowledge_detail/35751.html#title-kcs-y6y-f5n&quot;&gt;顶级域名后缀列表&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;（1）解析类型：&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;记录类型&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;作用&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;A记录&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;记录IPv4地址&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;CNAME记录&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;别名记录&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;AAAA记录&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;记录IPv6地址&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;一dns解析流程&quot;&gt;（一）DNS解析流程&lt;/h2&gt;

&lt;p&gt;（1）hosts文件查询&lt;/p&gt;

&lt;p&gt;（2）浏览器缓存&lt;/p&gt;

&lt;p&gt;（3）localDNS缓存&lt;/p&gt;

&lt;p&gt;（4）根服务器-&amp;gt;NS服务器递归查询&lt;/p&gt;

&lt;h2 id=&quot;二根服务器&quot;&gt;（二）根服务器&lt;/h2&gt;

&lt;p&gt;在IPv4中，因为历史技术网络传输限制，必须让所有的根服务器数据能包含在一个512字节的UDP包中，13台根服务器的域名分别是&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[a-m].root-servers.net.&lt;/code&gt;。其中IP地址占52字节，头部占8字节。&lt;/p&gt;

&lt;p&gt;在IPv6中，根服务器数据包含在一个4096字节的UDP包中，所以可以容纳25个根服务器信息。&lt;/p&gt;

&lt;p&gt;查看方法，安装named软件，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cat /var/named/named.ca&lt;/code&gt;即可看到13台根服务器的IPv4地址和IPv6地址。也就是在递归服务器来说，凡是要请求13台根服务器地址，就直接访问这个文件，获取出域名及IP。&lt;/p&gt;

&lt;p&gt;在IPv6中，部署在我国的4台DNS根服务器域名为bii.dns-lab.net（北京，主根），yeti-ns[1-3].dns-lab.net（3台辅根，南京、成都、广州）&lt;/p&gt;

&lt;p&gt;该DNS服务器作为递归服务器，类似于LocalDNS。&lt;/p&gt;

&lt;h2 id=&quot;三dns服务器和dig操作&quot;&gt;（三）DNS服务器和dig操作&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;opcode: 操作码,QUERY,代表是查询操作;
status: 状态,NOERROR,代表没有错误;
id: 编号,60954,16bit数字,在dns协议中,通过编号匹配返回和查询.
flags: 标志,如果出现就表示有标志,如果不出现,就表示为设置标志:
qr query,查询标志,代表是查询操作
rd recursion desired,代表希望进行递归查询操作;
ra recursive available在返回中设置,代表查询的服务器支持递归查询操作;
aa Authoritative Answer权威回复,如果查询结果由管理域名的域名服务器而不是缓存服务器提供的,则
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;解析仅供参考&quot;&gt;解析(仅供参考)&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@aliecs runtime]# dig host.taobao.com

; &amp;lt;&amp;lt;&amp;gt;&amp;gt; DiG 9.9.4-RedHat-9.9.4-73.el7_6 &amp;lt;&amp;lt;&amp;gt;&amp;gt; host.taobao.com
;; global options: +cmd
;; Got answer:
;; -&amp;gt;&amp;gt;HEADER&amp;lt;&amp;lt;- opcode: QUERY, status: NOERROR, id: 46904
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;host.taobao.com.		IN	A

;; ANSWER SECTION:
host.taobao.com.	1800	IN	CNAME	shop.taobao.com.
shop.taobao.com.	32	IN	CNAME	na61-na62.wagbridge.alibaba.taobao.com.
na61-na62.wagbridge.alibaba.taobao.com.	83 IN CNAME na61-na62.wagbridge.alibaba.taobao.com.gds.alibabadns.com.
na61-na62.wagbridge.alibaba.taobao.com.gds.alibabadns.com. 84 IN A 203.119.175.227

;; Query time: 25 msec
;; SERVER: 100.100.2.136#53(100.100.2.136)
;; WHEN: Thu Aug 29 14:20:04 CST 2019
;; MSG SIZE  rcvd: 189
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;四trace解析&quot;&gt;（四）Trace解析&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@aliecs ~]# dig ayouleyang.cn AAAA +trace

; &amp;lt;&amp;lt;&amp;gt;&amp;gt; DiG 9.9.4-RedHat-9.9.4-74.el7_6.2 &amp;lt;&amp;lt;&amp;gt;&amp;gt; ayouleyang.cn AAAA +trace
;; global options: +cmd
.			268178	IN	NS	j.root-servers.net.
.			268178	IN	NS	i.root-servers.net.
.			268178	IN	NS	k.root-servers.net.
.			268178	IN	NS	f.root-servers.net.
.			268178	IN	NS	b.root-servers.net.
.			268178	IN	NS	l.root-servers.net.
.			268178	IN	NS	m.root-servers.net.
.			268178	IN	NS	d.root-servers.net.
.			268178	IN	NS	h.root-servers.net.
.			268178	IN	NS	a.root-servers.net.
.			268178	IN	NS	e.root-servers.net.
.			268178	IN	NS	c.root-servers.net.
.			268178	IN	NS	g.root-servers.net.
.			500495	IN	RRSIG	NS 8 0 518400 20190929170000 20190916160000 59944 . rhQQ8tC8JbevwGjhGd65tIGRUcRlBvYXzNxzgomNYmVMGli7ptx4rjBP +mOBicBCiQYXi1dAH8Br3QqwR8MAb45BL8IxS/X+jn9e7Dd7jBWZguMf Qaqk6Kr5XtAtoH6+hB2FD9MBTVYD5rXeP+cv+uo60tko76FZNfiSZgEM yBRBzBp/11WvxI+wS6jiA+3BHF6sxZC61rg0PFrckb67Nfwww0lsdJPK BSd2NgKQz64wwvC9VB+M0BtdxRPFrZ7k2enOJccHTDBF55zgDV1nDi8W s79d01jsWLjM8bnUVeCoIywtwX1N+LeUwnxVSyMxk2cJ+fkOS4PQgorj 8Tus8w==
;; Received 525 bytes from 100.100.2.136#53(100.100.2.136) in 353 ms

cn.			172800	IN	NS	ns.cernet.net.
cn.			172800	IN	NS	g.dns.cn.
cn.			172800	IN	NS	f.dns.cn.
cn.			172800	IN	NS	b.dns.cn.
cn.			172800	IN	NS	d.dns.cn.
cn.			172800	IN	NS	a.dns.cn.
cn.			172800	IN	NS	c.dns.cn.
cn.			172800	IN	NS	e.dns.cn.
cn.			86400	IN	DS	57724 8 2 5D0423633EB24A499BE78AA22D1C0C9BA36218FF49FD95A4CDF1A4AD 97C67044
cn.			86400	IN	RRSIG	DS 8 1 86400 20190930050000 20190917040000 59944 . gILn4or/SX6xYErB+peeiZuKaRtO6Ti+SJ3Zb//seqeeFpfdr9EqAe41 MBqzZYdE2tpbjfT4tu1r61M/ZKiiHNNM8SDkQNIGk6H0uxIGxWpxgtkL eGibbPasUnrFN/33DjDS4WakWrcc6R6kaXAp1U52k1TFWmBRzr09tRs9 0nt5YpeEvQYNT0AUMWWbvX9L/f3nwCKfJ4IMVXweoM5uNpXxaSlDplRo ac+RWlzxhHeyWUQM8SaHOt9Mh0vULpdXlgI+rb3pQhXTRQgi98+4kh0E 3XF1hIFWM222Y9hkxkQxxvktmTvtnoc7WUX5EmWzEaX++60F/RJggKZz uS/RZg==
;; Received 704 bytes from 192.36.148.17#53(i.root-servers.net) in 331 ms

ayouleyang.cn.		86400	IN	NS	f1g1ns2.dnspod.net.
ayouleyang.cn.		86400	IN	NS	f1g1ns1.dnspod.net.
3QDAQA092EE5BELP64A74EBNB8J53D7E.cn. 21600 IN NSEC3 1 1 10 AEF123AB 3QLMP0QRNQ96G5AFGOPNB7U7IJ4MBP4B NS SOA RRSIG DNSKEY NSEC3PARAM
3QDAQA092EE5BELP64A74EBNB8J53D7E.cn. 21600 IN RRSIG NSEC3 8 2 21600 20191003083944 20190903073944 38388 cn. nBPCAciEgwp2mirCXaGWBtYbQXJbWYmWhtuCCvtbSBXRM0k1MT97kjBZ SFuMBHobaSl+ExBInvrVfgvlLEwcxuwrTzr0lMOdC8vOJWPA0JJBlN3Z gQ6/tb57tDY7PaZ6DdtNkV/CCPE3las0/hSSdNO9CuutrUYnLgPEKta4 psU=
CJRTHDI18QUG65U71KP3AG4VVS62PB8I.cn. 21600 IN NSEC3 1 1 10 AEF123AB CK4H42IGVVPNP7G5N48DNRRVC7AF3F51 CNAME RRSIG
CJRTHDI18QUG65U71KP3AG4VVS62PB8I.cn. 21600 IN RRSIG NSEC3 8 2 21600 20191003083944 20190903073944 38388 cn. OGlsfIQReAddiJd0BBntKw5qJ2yljBbkdr4IC3BB/X+HQbYJ6tDH6JxH 2peLcN2Qe7yAkhTxWSQuGL6yhrkhuzSGlvHL5VUEpYwSR8Xx7Ryi+Kk7 TRAqgQLLGSHbExM5vFO3ac5YzXtZ6N0jp3M717z+CTMcBQE/bzRLTeh9 Gno=
;; Received 587 bytes from 203.119.26.1#53(b.dns.cn) in 79 ms

ayouleyang.cn.		600	IN	AAAA	240e:e9:a001:2:21e:67ff:fe88:8be5
ayouleyang.cn.		86400	IN	NS	f1g1ns2.dnspod.net.
ayouleyang.cn.		86400	IN	NS	f1g1ns1.dnspod.net.
;; Received 134 bytes from 111.161.57.81#53(f1g1ns2.dnspod.net) in 5 ms
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;(1)向递归DNS查询根服务器信息&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;100.100.2.136&lt;/code&gt;，返回根服务器列表和IP(看不见)&lt;/p&gt;

&lt;p&gt;(2)向根服务器&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i.root-servers.net&lt;/code&gt;(192.36.148.17)查询&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cn.&lt;/code&gt;的 NS 记录。&lt;/p&gt;

&lt;p&gt;(3)向顶级域名服务器&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;b.dns.cn&lt;/code&gt;(203.119.26.1)查询&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ayouleyang.cn.&lt;/code&gt;的 NS 记录。收到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f1g1ns1.dnspod.net.&lt;/code&gt;和IP。&lt;/p&gt;

&lt;p&gt;(4)向域名服务器&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f1g1ns2.dnspod.net&lt;/code&gt;(111.161.57.81)查询&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ayouleyang.cn.&lt;/code&gt;的 AAAA 记录。收到IP为：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;240e:e9:a001:2:21e:67ff:fe88:8be5&lt;/code&gt;。&lt;/p&gt;

&lt;h2 id=&quot;五抓包&quot;&gt;（五）抓包&lt;/h2&gt;

&lt;p&gt;DNS客户端IP是1.204.25.92，执行了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ping host.taobao.com&lt;/code&gt;命令。&lt;/p&gt;

&lt;p&gt;在DNS服务器抓包得到以下结果：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@test named]# tcpdump -X -i eth0 -vvvv -n port 53
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
16:52:19.652007 IP (tos 0x0, ttl 116, id 13073, offset 0, flags [none], proto UDP (17), length 61)
    1.204.25.92.35906 &amp;gt; 172.16.0.14.domain: [udp sum ok] 27187+ A? host.taobao.com. (33)
	0x0000:  4500 003d 3311 0000 7411 4c59 01cc 195c  E..=3...t.LY...\
	0x0010:  ac10 000e 8c42 0035 0029 9ec4 6a33 0100  .....B.5.)..j3..
	0x0020:  0001 0000 0000 0000 0468 6f73 7406 7461  .........host.ta
	0x0030:  6f62 616f 0363 6f6d 0000 0100 01         obao.com.....
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;1204259235906-向-17216014domaindns递归服务器-端口查询-hosttaobaocom&quot;&gt;1.204.25.92:35906 向 172.16.0.14:domain(DNS递归服务器) 端口查询 host.taobao.com.&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;16:52:19.652459 IP (tos 0x0, ttl 64, id 49508, offset 0, flags [none], proto UDP (17), length 72)
    172.16.0.14.51437 &amp;gt; 140.205.122.34.domain: [bad udp cksum 0xb353 -&amp;gt; 0x8027!] 53532 [1au] A? host.taobao.com. ar: . OPT UDPsize=4096 DO (44)
	0x0000:  4500 0048 c164 0000 4011 0633 ac10 000e  E..H.d..@..3....
	0x0010:  8ccd 7a22 c8ed 0035 0034 b353 d11c 0000  ..z&quot;...5.4.S....
	0x0020:  0001 0000 0000 0001 0468 6f73 7406 7461  .........host.ta
	0x0030:  6f62 616f 0363 6f6d 0000 0100 0100 0029  obao.com.......)
	0x0040:  1000 0000 8000 0000                      ........
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;1721601451437dns递归服务器-向-14020512234domain-查询-hosttaobaocom&quot;&gt;172.16.0.14:51437(DNS递归服务器) 向 140.205.122.34:domain 查询 host.taobao.com.&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;16:52:19.684333 IP (tos 0x68, ttl 114, id 49508, offset 0, flags [none], proto UDP (17), length 101)
    140.205.122.34.domain &amp;gt; 172.16.0.14.51437: [no cksum] 53532*- q: A? host.taobao.com. 1/0/1 host.taobao.com. [30m] CNAME shop.taobao.com. ar: . OPT UDPsize=4096 (73)
	0x0000:  4568 0065 c164 0000 7211 d3ad 8ccd 7a22  Eh.e.d..r.....z&quot;
	0x0010:  ac10 000e 0035 c8ed 0051 0000 d11c 8400  .....5...Q......
	0x0020:  0001 0001 0000 0001 0468 6f73 7406 7461  .........host.ta
	0x0030:  6f62 616f 0363 6f6d 0000 0100 01c0 0c00  obao.com........
	0x0040:  0500 0100 0007 0800 1104 7368 6f70 0674  ..........shop.t
	0x0050:  616f 6261 6f03 636f 6d00 0000 2910 0000  aobao.com...)...
	0x0060:  0000 0000 00                             .....
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;14020512234-响应-hosttaobaocom-cname-shoptaobaocom&quot;&gt;140.205.122.34 响应 host.taobao.com. CNAME shop.taobao.com.&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;16:52:19.685197 IP (tos 0x0, ttl 64, id 49333, offset 0, flags [none], proto UDP (17), length 67)
    172.16.0.14.ratio-adp &amp;gt; 192.33.14.30.domain: [bad udp cksum 0x7a9e -&amp;gt; 0xe79f!] 26003 [1au] DS? taobao.com. ar: . OPT UDPsize=4096 DO (39)
	0x0000:  4500 0043 c0b5 0000 4011 3f97 ac10 000e  E..C....@.?.....
	0x0010:  c021 0e1e 0454 0035 002f 7a9e 6593 0000  .!...T.5./z.e...
	0x0020:  0001 0000 0000 0001 0674 616f 6261 6f03  .........taobao.
	0x0030:  636f 6d00 002b 0001 0000 2910 0000 0080  com..+....).....
	0x0040:  0000 00                                  ...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;17216014dns递归服务器-向-192331430-查询-taobaocom&quot;&gt;172.16.0.14(DNS递归服务器) 向 192.33.14.30 查询 taobao.com.&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;16:52:19.905861 IP (tos 0x0, ttl 44, id 448, offset 0, flags [none], proto UDP (17), length 788)
    192.33.14.30.domain &amp;gt; 172.16.0.14.ratio-adp: [udp sum ok] 26003*- q: DS? taobao.com. 0/6/1 ns: CK0POJMG874LJREF7EFN8430QVIT8BSM.com. [1d] Type50, CK0POJMG874LJREF7EFN8430QVIT8BSM.com. [1d] RRSIG, com. [15m] SOA a.gtld-servers.net. nstld.verisign-grs.com. 1563785520 1800 900 604800 86400, com. [15m] RRSIG, D9N2NBDP552JID7GKU1AT4Q7OVJ57K56.com. [1d] Type50, D9N2NBDP552JID7GKU1AT4Q7OVJ57K56.com. [1d] RRSIG ar: . OPT UDPsize=4096 DO (760)
	0x0000:  4500 0314 01c0 0000 2c11 0fbc c021 0e1e  E.......,....!..
	0x0010:  ac10 000e 0035 0454 0300 78d0 6593 8400  .....5.T..x.e...
	0x0020:  0001 0000 0006 0001 0674 616f 6261 6f03  .........taobao.
	0x0030:  636f 6d00 002b 0001 2043 4b30 504f 4a4d  com..+...CK0POJM
	0x0040:  4738 3734 4c4a 5245 4637 4546 4e38 3433  G874LJREF7EFN843
	0x0050:  3051 5649 5438 4253 4dc0 1300 3200 0100  0QVIT8BSM...2...
	0x0060:  0151 8000 2301 0100 0000 1465 01a0 c257  .Q..#......e...W
	0x0070:  20ee 156f 6c4e 3963 6b3a da03 12d9 2a00  ...olN9ck:....*.
	0x0080:  0722 0000 0000 0290 c01c 002e 0001 0001  .&quot;..............
	0x0090:  5180 0097 0032 0802 0001 5180 5d3a 8515  Q....2....Q.]:..
	0x00a0:  5d31 3a2d 452c 0363 6f6d 00a5 104f e784  ]1:-E,.com...O..
	0x00b0:  a2df 518d 31c5 19af 90bd 688d 00b5 957c  ..Q.1.....h....|
	0x00c0:  ac8d 361e 29d6 e887 89d0 4990 3cbd f2bd  ..6.).....I.&amp;lt;...
	0x00d0:  7ca3 d524 137a 6593 f028 babc 9a77 a915  |..$.ze..(...w..
	0x00e0:  a9f6 8d50 cc38 2bbf 42ed 7e3a e9b1 a7c9  ...P.8+.B.~:....
	0x00f0:  1f7d bdd4 d76e 6ae3 1730 28dc 819a a151  .}...nj..0(....Q
	0x0100:  5d08 6b34 1b8d a184 2fd5 4314 511d d976  ].k4..../.C.Q..v
	0x0110:  2727 6d1f 6d71 4d63 4eba e0ed ec63 06bc  &apos;&apos;m.mqMcN....c..
	0x0120:  ac22 c7f2 e107 bf46 319c 14c0 1300 0600  .&quot;.....F1.......
	0x0130:  0100 0003 8400 3d01 610c 6774 6c64 2d73  ......=.a.gtld-s
	0x0140:  6572 7665 7273 036e 6574 0005 6e73 746c  ervers.net..nstl
	0x0150:  640c 7665 7269 7369 676e 2d67 7273 c013  d.verisign-grs..
	0x0160:  5d35 7930 0000 0708 0000 0384 0009 3a80  ]5y0..........:.
	0x0170:  0001 5180 c013 002e 0001 0000 0384 0097  ..Q.............
	0x0180:  0006 0801 0000 0384 5d3e b3b0 5d35 68c8  ........]&amp;gt;..]5h.
	0x0190:  452c 0363 6f6d 0001 43ff b906 93f8 9508  E,.com..C.......
	0x01a0:  bc4a a4e0 ca20 78f0 af39 2379 a072 7520  .J....x..9#y.ru.
	0x01b0:  628a c8e7 61ce 602c 9274 297e 4573 7175  b...a.`,.t)~Esqu
	0x01c0:  1d85 3fba cb55 3941 3c6c 8978 b27d 9caf  ..?..U9A&amp;lt;l.x.}..
	0x01d0:  4cac ed9d 9ab8 0a04 d5b6 25a6 9f96 3dc4  L.........%...=.
	0x01e0:  e894 be85 d081 2691 7d85 8a4a 5f4e fa6a  ......&amp;amp;.}..J_N.j
	0x01f0:  28f9 9230 865e fe33 b610 e348 b9db 09ef  (..0.^.3...H....
	0x0200:  4b41 3eb1 5dab 3de4 f44f 0bd8 ce11 e363  KA&amp;gt;.].=..O.....c
	0x0210:  f597 6e29 bafd 9320 4439 4e32 4e42 4450  ..n)....D9N2NBDP
	0x0220:  3535 324a 4944 3747 4b55 3141 5434 5137  552JID7GKU1AT4Q7
	0x0230:  4f56 4a35 374b 3536 c013 0032 0001 0001  OVJ57K56...2....
	0x0240:  5180 0022 0101 0000 0014 6a6e 41f7 1b6b  Q..&quot;......jnA..k
	0x0250:  9c84 45da 7a24 79b2 667d 100b b410 0006  ..E.z$y.f}......
	0x0260:  2000 0000 0012 c1fb 002e 0001 0001 5180  ..............Q.
	0x0270:  0097 0032 0802 0001 5180 5d3e 8397 5d35  ...2....Q.]&amp;gt;..]5
	0x0280:  38af 452c 0363 6f6d 003b 65c3 4d34 617a  8.E,.com.;e.M4az
	0x0290:  a88b 3c0c 195e 4541 e1f1 cdf1 8d0e 5715  ..&amp;lt;..^EA......W.
	0x02a0:  1f28 9c0e 6d69 5ef5 8b2a c1f6 1d86 0d06  .(..mi^..*......
	0x02b0:  cb54 8182 cfd3 6b75 e720 ae0f daf0 eb4b  .T....ku.......K
	0x02c0:  eb97 0b75 d0d0 0a73 de68 b55c 6d7c 6c9f  ...u...s.h.\m|l.
	0x02d0:  8032 2d4b fdb9 9010 7e83 c688 bd0e 0192  .2-K....~.......
	0x02e0:  cfbd a37d 5c28 7eb0 8b35 99e5 5728 f55c  ...}\(~..5..W(.\
	0x02f0:  6d66 c8db 4f41 85e1 6cb6 7563 27dc 01d7  mf..OA..l.uc&apos;...
	0x0300:  b9f7 a76d 89d0 2dff 0f00 0029 1000 0000  ...m..-....)....
	0x0310:  8000 0000                                ....
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;192331430-响应了很多数据&quot;&gt;192.33.14.30 响应了很多数据&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;16:52:19.907384 IP (tos 0x0, ttl 64, id 683, offset 0, flags [none], proto UDP (17), length 72)
    172.16.0.14.33425 &amp;gt; 106.11.35.25.domain: [bad udp cksum 0x3988 -&amp;gt; 0x7815!] 42063 [1au] A? shop.taobao.com. ar: . OPT UDPsize=4096 DO (44)
	0x0000:  4500 0048 02ab 0000 4011 3eb8 ac10 000e  E..H....@.&amp;gt;.....
	0x0010:  6a0b 2319 8291 0035 0034 3988 a44f 0000  j.#....5.49..O..
	0x0020:  0001 0000 0000 0001 0473 686f 7006 7461  .........shop.ta
	0x0030:  6f62 616f 0363 6f6d 0000 0100 0100 0029  obao.com.......)
	0x0040:  1000 0000 8000 0000                      ........
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;###&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;16:52:19.948549 IP (tos 0x68, ttl 113, id 683, offset 0, flags [none], proto UDP (17), length 124)
    106.11.35.25.domain &amp;gt; 172.16.0.14.33425: [no cksum] 42063*- q: A? shop.taobao.com. 1/0/1 shop.taobao.com. [2m] CNAME na61-na62.wagbridge.alibaba.taobao.com. ar: . OPT UDPsize=4096 (96)
	0x0000:  4568 007c 02ab 0000 7111 0d1c 6a0b 2319  Eh.|....q...j.#.
	0x0010:  ac10 000e 0035 8291 0068 0000 a44f 8400  .....5...h...O..
	0x0020:  0001 0001 0000 0001 0473 686f 7006 7461  .........shop.ta
	0x0030:  6f62 616f 0363 6f6d 0000 0100 01c0 0c00  obao.com........
	0x0040:  0500 0100 0000 7800 2809 6e61 3631 2d6e  ......x.(.na61-n
	0x0050:  6136 3209 7761 6762 7269 6467 6507 616c  a62.wagbridge.al
	0x0060:  6962 6162 6106 7461 6f62 616f 0363 6f6d  ibaba.taobao.com
	0x0070:  0000 0029 1000 0000 0000 0000            ...)........
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;shoptaobaocom-cname到-na61-na62wagbridgealibabataobaocom&quot;&gt;shop.taobao.com. CNAME到 na61-na62.wagbridge.alibaba.taobao.com.&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;16:52:19.949466 IP (tos 0x0, ttl 64, id 1631, offset 0, flags [none], proto UDP (17), length 95)
    172.16.0.14.17351 &amp;gt; 106.11.35.26.domain: [bad udp cksum 0x39a0 -&amp;gt; 0x3a4e!] 64880 [1au] A? na61-na62.wagbridge.alibaba.taobao.com. ar: . OPT UDPsize=4096 DO (67)
	0x0000:  4500 005f 065f 0000 4011 3aec ac10 000e  E.._._..@.:.....
	0x0010:  6a0b 231a 43c7 0035 004b 39a0 fd70 0000  j.#.C..5.K9..p..
	0x0020:  0001 0000 0000 0001 096e 6136 312d 6e61  .........na61-na
	0x0030:  3632 0977 6167 6272 6964 6765 0761 6c69  62.wagbridge.ali
	0x0040:  6261 6261 0674 616f 6261 6f03 636f 6d00  baba.taobao.com.
	0x0050:  0001 0001 0000 2910 0000 0080 0000 00    ......)........
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;请求包&quot;&gt;请求包。&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;16:52:19.993238 IP (tos 0x68, ttl 113, id 1631, offset 0, flags [none], proto UDP (17), length 166)
    106.11.35.26.domain &amp;gt; 172.16.0.14.17351: [no cksum] 64880*- q: A? na61-na62.wagbridge.alibaba.taobao.com. 1/0/1 na61-na62.wagbridge.alibaba.taobao.com. [5m] CNAME na61-na62.wagbridge.alibaba.taobao.com.gds.alibabadns.com. ar: . OPT UDPsize=4096 (138)
	0x0000:  4568 00a6 065f 0000 7111 093d 6a0b 231a  Eh..._..q..=j.#.
	0x0010:  ac10 000e 0035 43c7 0092 0000 fd70 8400  .....5C......p..
	0x0020:  0001 0001 0000 0001 096e 6136 312d 6e61  .........na61-na
	0x0030:  3632 0977 6167 6272 6964 6765 0761 6c69  62.wagbridge.ali
	0x0040:  6261 6261 0674 616f 6261 6f03 636f 6d00  baba.taobao.com.
	0x0050:  0001 0001 c00c 0005 0001 0000 012c 003b  .............,.;
	0x0060:  096e 6136 312d 6e61 3632 0977 6167 6272  .na61-na62.wagbr
	0x0070:  6964 6765 0761 6c69 6261 6261 0674 616f  idge.alibaba.tao
	0x0080:  6261 6f03 636f 6d03 6764 730a 616c 6962  bao.com.gds.alib
	0x0090:  6162 6164 6e73 0363 6f6d 0000 0029 1000  abadns.com...)..
	0x00a0:  0000 0000 0000                           ......
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;na61-na62wagbridgealibabataobaocom-cname-到-na61-na62wagbridgealibabataobaocomgdsalibabadnscom&quot;&gt;na61-na62.wagbridge.alibaba.taobao.com. CNAME 到 na61-na62.wagbridge.alibaba.taobao.com.gds.alibabadns.com.&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;16:52:19.994023 IP (tos 0x0, ttl 64, id 39253, offset 0, flags [none], proto UDP (17), length 114)
    172.16.0.14.40487 &amp;gt; 140.205.67.254.domain: [bad udp cksum 0x7d59 -&amp;gt; 0x041e!] 58257 [1au] A? na61-na62.wagbridge.alibaba.taobao.com.gds.alibabadns.com. ar: . OPT UDPsize=4096 DO (86)
	0x0000:  4500 0072 9955 0000 4011 643c ac10 000e  E..r.U..@.d&amp;lt;....
	0x0010:  8ccd 43fe 9e27 0035 005e 7d59 e391 0000  ..C..&apos;.5.^}Y....
	0x0020:  0001 0000 0000 0001 096e 6136 312d 6e61  .........na61-na
	0x0030:  3632 0977 6167 6272 6964 6765 0761 6c69  62.wagbridge.ali
	0x0040:  6261 6261 0674 616f 6261 6f03 636f 6d03  baba.taobao.com.
	0x0050:  6764 730a 616c 6962 6162 6164 6e73 0363  gds.alibabadns.c
	0x0060:  6f6d 0000 0100 0100 0029 1000 0000 8000  om.......)......
	0x0070:  0000                                     ..
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;请求包-1&quot;&gt;请求包。&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;16:52:20.019355 IP (tos 0x68, ttl 115, id 39253, offset 0, flags [none], proto UDP (17), length 130)
    140.205.67.254.domain &amp;gt; 172.16.0.14.40487: [no cksum] 58257*- q: A? na61-na62.wagbridge.alibaba.taobao.com.gds.alibabadns.com. 1/0/1 na61-na62.wagbridge.alibaba.taobao.com.gds.alibabadns.com. [2m] A 203.119.169.6 ar: . OPT UDPsize=4096 (102)
	0x0000:  4568 0082 9955 0000 7311 30c4 8ccd 43fe  Eh...U..s.0...C.
	0x0010:  ac10 000e 0035 9e27 006e 0000 e391 8400  .....5.&apos;.n......
	0x0020:  0001 0001 0000 0001 096e 6136 312d 6e61  .........na61-na
	0x0030:  3632 0977 6167 6272 6964 6765 0761 6c69  62.wagbridge.ali
	0x0040:  6261 6261 0674 616f 6261 6f03 636f 6d03  baba.taobao.com.
	0x0050:  6764 730a 616c 6962 6162 6164 6e73 0363  gds.alibabadns.c
	0x0060:  6f6d 0000 0100 01c0 0c00 0100 0100 0000  om..............
	0x0070:  7800 04cb 77a9 0600 0029 1000 0000 0000  x...w....)......
	0x0080:  0000                                     ..
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;na61-na62wagbridgealibabataobaocomgdsalibabadnscom-a-2031191696&quot;&gt;na61-na62.wagbridge.alibaba.taobao.com.gds.alibabadns.com. A 203.119.169.6&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;16:52:20.020093 IP (tos 0x0, ttl 64, id 4687, offset 0, flags [none], proto UDP (17), length 71)
    172.16.0.14.39180 &amp;gt; 192.54.112.30.domain: [bad udp cksum 0xdcb7 -&amp;gt; 0x37e9!] 17597 [1au] DS? alibabadns.com. ar: . OPT UDPsize=4096 DO (43)
	0x0000:  4500 0047 124f 0000 4011 8be4 ac10 000e  E..G.O..@.......
	0x0010:  c036 701e 990c 0035 0033 dcb7 44bd 0000  .6p....5.3..D...
	0x0020:  0001 0000 0000 0001 0a61 6c69 6261 6261  .........alibaba
	0x0030:  646e 7303 636f 6d00 002b 0001 0000 2910  dns.com..+....).
	0x0040:  0000 0080 0000 00                        .......
16:52:20.214745 IP (tos 0x60, ttl 116, id 13079, offset 0, flags [none], proto UDP (17), length 61)
    1.204.25.92.35906 &amp;gt; 172.16.0.14.domain: [udp sum ok] 27187+ A? host.taobao.com. (33)
	0x0000:  4560 003d 3317 0000 7411 4bf3 01cc 195c  E`.=3...t.K....\
	0x0010:  ac10 000e 8c42 0035 0029 9ec4 6a33 0100  .....B.5.)..j3..
	0x0020:  0001 0000 0000 0000 0468 6f73 7406 7461  .........host.ta
	0x0030:  6f62 616f 0363 6f6d 0000 0100 01         obao.com.....
16:52:20.229622 IP (tos 0x0, ttl 51, id 27788, offset 0, flags [none], proto UDP (17), length 792)
    192.54.112.30.domain &amp;gt; 172.16.0.14.39180: [udp sum ok] 17597*- q: DS? alibabadns.com. 0/6/1 ns: CK0POJMG874LJREF7EFN8430QVIT8BSM.com. [1d] Type50, CK0POJMG874LJREF7EFN8430QVIT8BSM.com. [1d] RRSIG, com. [15m] SOA a.gtld-servers.net. nstld.verisign-grs.com. 1563785520 1800 900 604800 86400, com. [15m] RRSIG, IT4VUBFNNQHBDB3JT0SLM7E2VT6TLH2L.com. [1d] Type50, IT4VUBFNNQHBDB3JT0SLM7E2VT6TLH2L.com. [1d] RRSIG ar: . OPT UDPsize=4096 DO (764)
	0x0000:  4500 0318 6c8c 0000 3311 3bd6 c036 701e  E...l...3.;..6p.
	0x0010:  ac10 000e 0035 990c 0304 206e 44bd 8400  .....5.....nD...
	0x0020:  0001 0000 0006 0001 0a61 6c69 6261 6261  .........alibaba
	0x0030:  646e 7303 636f 6d00 002b 0001 2043 4b30  dns.com..+...CK0
	0x0040:  504f 4a4d 4738 3734 4c4a 5245 4637 4546  POJMG874LJREF7EF
	0x0050:  4e38 3433 3051 5649 5438 4253 4dc0 1700  N8430QVIT8BSM...
	0x0060:  3200 0100 0151 8000 2301 0100 0000 1465  2....Q..#......e
	0x0070:  01a0 c257 20ee 156f 6c4e 3963 6b3a da03  ...W...olN9ck:..
	0x0080:  12d9 2a00 0722 0000 0000 0290 c020 002e  ..*..&quot;..........
	0x0090:  0001 0001 5180 0097 0032 0802 0001 5180  ....Q....2....Q.
	0x00a0:  5d3a 8515 5d31 3a2d 452c 0363 6f6d 00a5  ]:..]1:-E,.com..
	0x00b0:  104f e784 a2df 518d 31c5 19af 90bd 688d  .O....Q.1.....h.
	0x00c0:  00b5 957c ac8d 361e 29d6 e887 89d0 4990  ...|..6.).....I.
	0x00d0:  3cbd f2bd 7ca3 d524 137a 6593 f028 babc  &amp;lt;...|..$.ze..(..
	0x00e0:  9a77 a915 a9f6 8d50 cc38 2bbf 42ed 7e3a  .w.....P.8+.B.~:
	0x00f0:  e9b1 a7c9 1f7d bdd4 d76e 6ae3 1730 28dc  .....}...nj..0(.
	0x0100:  819a a151 5d08 6b34 1b8d a184 2fd5 4314  ...Q].k4..../.C.
	0x0110:  511d d976 2727 6d1f 6d71 4d63 4eba e0ed  Q..v&apos;&apos;m.mqMcN...
	0x0120:  ec63 06bc ac22 c7f2 e107 bf46 319c 14c0  .c...&quot;.....F1...
	0x0130:  1700 0600 0100 0003 8400 3d01 610c 6774  ..........=.a.gt
	0x0140:  6c64 2d73 6572 7665 7273 036e 6574 0005  ld-servers.net..
	0x0150:  6e73 746c 640c 7665 7269 7369 676e 2d67  nstld.verisign-g
	0x0160:  7273 c017 5d35 7930 0000 0708 0000 0384  rs..]5y0........
	0x0170:  0009 3a80 0001 5180 c017 002e 0001 0000  ..:...Q.........
	0x0180:  0384 0097 0006 0801 0000 0384 5d3e b3b0  ............]&amp;gt;..
	0x0190:  5d35 68c8 452c 0363 6f6d 0001 43ff b906  ]5h.E,.com..C...
	0x01a0:  93f8 9508 bc4a a4e0 ca20 78f0 af39 2379  .....J....x..9#y
	0x01b0:  a072 7520 628a c8e7 61ce 602c 9274 297e  .ru.b...a.`,.t)~
	0x01c0:  4573 7175 1d85 3fba cb55 3941 3c6c 8978  Esqu..?..U9A&amp;lt;l.x
	0x01d0:  b27d 9caf 4cac ed9d 9ab8 0a04 d5b6 25a6  .}..L.........%.
	0x01e0:  9f96 3dc4 e894 be85 d081 2691 7d85 8a4a  ..=.......&amp;amp;.}..J
	0x01f0:  5f4e fa6a 28f9 9230 865e fe33 b610 e348  _N.j(..0.^.3...H
	0x0200:  b9db 09ef 4b41 3eb1 5dab 3de4 f44f 0bd8  ....KA&amp;gt;.].=..O..
	0x0210:  ce11 e363 f597 6e29 bafd 9320 4954 3456  ...c..n)....IT4V
	0x0220:  5542 464e 4e51 4842 4442 334a 5430 534c  UBFNNQHBDB3JT0SL
	0x0230:  4d37 4532 5654 3654 4c48 324c c017 0032  M7E2VT6TLH2L...2
	0x0240:  0001 0001 5180 0022 0101 0000 0014 974a  ....Q..&quot;.......J
	0x0250:  1aca 3261 bf94 c564 8504 059b 1bfa fe89  ..2a...d........
	0x0260:  12df 0006 2000 0000 0012 c1ff 002e 0001  ................
	0x0270:  0001 5180 0097 0032 0802 0001 5180 5d3e  ..Q....2....Q.]&amp;gt;
	0x0280:  7bc3 5d35 30db 452c 0363 6f6d 006c 3637  {.]50.E,.com.l67
	0x0290:  fa4c cf0a 957a 1c02 7cad e015 25a7 fa52  .L...z..|...%..R
	0x02a0:  40f6 c7c8 3d27 e2f5 78c5 a673 a7be 9587  @...=&apos;..x..s....
	0x02b0:  2255 bb5b 209d 1e2a d110 1c31 33d7 b9bd  &quot;U.[...*...13...
	0x02c0:  b931 b791 189f d950 d3df 9aba 3b9a 5e7e  .1.....P....;.^~
	0x02d0:  8fb8 38e3 548c 1fb2 5489 c4a2 093a e726  ..8.T...T....:.&amp;amp;
	0x02e0:  d294 3d30 594f fa76 8a48 cdc0 985f a8db  ..=0YO.v.H..._..
	0x02f0:  6e6f a2a0 7a20 eaf9 c188 ee1a f76a 080b  no..z........j..
	0x0300:  fe1e 2217 e652 97ac 5359 a6b6 5600 0029  ..&quot;..R..SY..V..)
	0x0310:  1000 0000 8000 0000                      ........
16:52:20.230833 IP (tos 0x0, ttl 64, id 62229, offset 0, flags [none], proto UDP (17), length 306)
    172.16.0.14.domain &amp;gt; 1.204.25.92.35906: [bad udp cksum 0xc875 -&amp;gt; 0xc857!] 27187 q: A? host.taobao.com. 4/2/4 host.taobao.com. [30m] CNAME shop.taobao.com., shop.taobao.com. [2m] CNAME na61-na62.wagbridge.alibaba.taobao.com., na61-na62.wagbridge.alibaba.taobao.com. [5m] CNAME na61-na62.wagbridge.alibaba.taobao.com.gds.alibabadns.com., na61-na62.wagbridge.alibaba.taobao.com.gds.alibabadns.com. [2m] A 203.119.169.6 ns: alibabadns.com. [1d23h26m20s] NS ns2.alibabadns.com., alibabadns.com. [1d23h26m20s] NS ns1.alibabadns.com. ar: ns1.alibabadns.com. [1d23h23m29s] A 140.205.122.66, ns1.alibabadns.com. [1d23h23m29s] A 198.11.138.254, ns2.alibabadns.com. [1d23h23m29s] A 140.205.67.254, ns2.alibabadns.com. [1d23h23m29s] A 106.11.35.18 (278)
	0x0000:  4500 0132 f315 0000 4011 bf5f ac10 000e  E..2....@.._....
	0x0010:  01cc 195c 0035 8c42 011e c875 6a33 8180  ...\.5.B...uj3..
	0x0020:  0001 0004 0002 0004 0468 6f73 7406 7461  .........host.ta
	0x0030:  6f62 616f 0363 6f6d 0000 0100 01c0 0c00  obao.com........
	0x0040:  0500 0100 0007 0800 0704 7368 6f70 c011  ..........shop..
	0x0050:  c02d 0005 0001 0000 0078 001e 096e 6136  .-.......x...na6
	0x0060:  312d 6e61 3632 0977 6167 6272 6964 6765  1-na62.wagbridge
	0x0070:  0761 6c69 6261 6261 c011 c040 0005 0001  .alibaba...@....
	0x0080:  0000 012c 0038 096e 6136 312d 6e61 3632  ...,.8.na61-na62
	0x0090:  0977 6167 6272 6964 6765 0761 6c69 6261  .wagbridge.aliba
	0x00a0:  6261 0674 616f 6261 6f03 636f 6d03 6764  ba.taobao.com.gd
	0x00b0:  730a 616c 6962 6162 6164 6e73 c018 c06a  s.alibabadns...j
	0x00c0:  0001 0001 0000 0078 0004 cb77 a906 c095  .......x...w....
	0x00d0:  0002 0001 0002 9b1c 0006 036e 7332 c095  ...........ns2..
	0x00e0:  c095 0002 0001 0002 9b1c 0006 036e 7331  .............ns1
	0x00f0:  c095 c0d0 0001 0001 0002 9a71 0004 8ccd  ...........q....
	0x0100:  7a42 c0d0 0001 0001 0002 9a71 0004 c60b  zB.........q....
	0x0110:  8afe c0be 0001 0001 0002 9a71 0004 8ccd  ...........q....
	0x0120:  43fe c0be 0001 0001 0002 9a71 0004 6a0b  C..........q..j.
	0x0130:  2312                                     #.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;参考文档：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://cloud.tencent.com/developer/article/1147777&quot;&gt;根域名的知识&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.csdn.net/xf_87/article/details/51943152&quot;&gt;linux中dig命令返回结果解释&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.west.cn/docs/47168.html&quot;&gt;根服务器为什么只能有13个&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.west.cn/docs/61389.html&quot;&gt;根域名服务器为什么只有13台&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzAxMTkwODIyNA==&amp;amp;mid=2247494866&amp;amp;idx=1&amp;amp;sn=b209532a99f8d93ceb1b35daf79401f8&amp;amp;chksm=9bbb493dacccc02b49e00137e57868448bd9e3c3136a73d8ebbbe422103121e4ecaebe396fd3&amp;amp;mpshare=1&amp;amp;scene=1&amp;amp;srcid=&amp;amp;sharer_sharetime=1586701984493&amp;amp;sharer_shareid=37ee1a4098b78fb47058be76f609635d&amp;amp;key=d95334ea08fa3d098d6c7232cbc6b6e1cb8286d6c1f360d5e07d2267792db9b4e6fc6c124f91856f3b7b72f906382f49568c52467fd01acf0ffd3ca13d88c990085a7cc947474d4fd64629be45eabcff&amp;amp;ascene=1&amp;amp;uin=MTgwNDM3NzYxOA%3D%3D&amp;amp;devicetype=Windows+10&amp;amp;version=62080085&amp;amp;lang=zh_CN&amp;amp;exportkey=A0Cz60dl5TIDdwEkvSUpRHA%3D&amp;amp;pass_ticket=FW1Yv0N3Y%2FnIKpz8OFWvO0dLytJy%2F4zuCEyqjbxWh2x%2Ba9M3HQAlMLgF3JDV9RX%2B&quot;&gt;DNS为什么查询根域名服务器只返回13个IP地址&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s/INt0UVFdFk828vY2tY6iyg&quot;&gt;万字长文DNS协议！&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>阿里云OSS使用笔记</title>
   <link href="https://comeround.cn/article/aliyun-oss-note.html"/>
   <updated>2019-07-20T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/aliyun-oss-note</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;记得上次，大概3个月前，我使用阿里云PHP SDK试了很久实现不了文件上传到OSS功能。现在随便试了下Python SDK，复制代码两分钟便实现了文件上传至阿里云OSS，由此，便写下了这篇关于OSS的使用笔记。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;在这之前，我是使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;硅云服务器&lt;/code&gt;备份我的数据库，之前购买的价格便宜，一个月5元左右，不过现在没有优惠了，一年200元，我肯定不会选择这种方案。早都发现了阿里云OSS有备份文件数据的功能，但之前使用PHP SDK没成功。这次，基本可以使用OSS备份文件的方案了。另外，阿里云OSS可以提供类似于静态网页功能，可以使用该HTTP服务提供网页浏览、文件下载等功能。&lt;/p&gt;

&lt;h2 id=&quot;1python上传文件&quot;&gt;（1）Python上传文件&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://help.aliyun.com/document_detail/85288.html?spm=a2c4g.11186623.6.870.68bd3ebdR1ezFF&quot;&gt;阿里云OSS-Python-SDK文档&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;安装步骤：
    &lt;ul&gt;
      &lt;li&gt;安装Python：（略，Python3.6以上就可以了）&lt;/li&gt;
      &lt;li&gt;安装pip包：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pip3 install oss2&lt;/code&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;#!/usr/bin/env python
# -*- coding: utf-8 -*-
&lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;oss2&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 阿里云主账号AccessKey拥有所有API的访问权限，风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维，请登录 https://ram.console.aliyun.com 创建RAM账号。
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;auth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;oss2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Auth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;LTAIF0txxxxxxx&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;MIvATY6wZUpymoxxxxxxxxxx&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# Endpoint以杭州为例，其它Region请按实际情况填写。
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bucket&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;oss2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;auth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;http://oss-cn-shenzhen.aliyuncs.com&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;xxxx-shenzhen&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# 必须以二进制的方式打开文件，因为需要知道文件包含的字节数。
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;697fe033d50b2b2c646964b012d4e4cf.jpg&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;rb&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fileobj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# Seek方法用于指定从第1000个字节位置开始读写。上传时会从您指定的第1000个字节位置开始上传，直到文件结束。
&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# fileobj.seek(1000, os.SEEK_SET)
&lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# Tell方法用于返回当前位置。
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;current&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fileobj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;tell&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# put_object第一个参数为对象名，即文件名，或者绝对路径/backup/aaa.zip
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;put_object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;697fe033d50b2b2c646964b012d4e4cf.jpg&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fileobj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# bucket.put_object_from_file(&apos;&amp;lt;yourObjectName&amp;gt;&apos;, &apos;&amp;lt;yourLocalFile&amp;gt;&apos;)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/oss.upfile.list.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;697fe033d50b2b2c646964b012d4e4cf.jpg&lt;/code&gt;即为上传之后的文件&lt;/p&gt;

&lt;h2 id=&quot;2发布静态网站&quot;&gt;（2）发布静态网站&lt;/h2&gt;

&lt;p&gt;1）设置Bucket权限为公共读&lt;/p&gt;

&lt;p&gt;2）设置静态网站首页页面&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/oss.read.acl.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;3）添加自己的域名&lt;/p&gt;

&lt;p&gt;到域名管理选项卡，点击添加自己的域名即可；注意域名需要CNAME到Bucket的外网访问域名。&lt;/p&gt;

&lt;p&gt;4）浏览器访问静态网站&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/oss.preview.site.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;5）问题：为什么不使用OSS自带的域名？&lt;/p&gt;

&lt;p&gt;如果直接使用OSS默认域名从互联网访问OSS上网页类型文件，Response Header中会自动加上&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Content-Disposition:&apos;attachment=filename;&apos;&lt;/code&gt;。即从浏览器访问网页类型文件时，会以附件形式进行下载。&lt;/p&gt;

&lt;h2 id=&quot;3实现mysql数据库自动备份到阿里云oss&quot;&gt;（3）实现MySQL数据库自动备份到阿里云OSS&lt;/h2&gt;

&lt;p&gt;1）首先编写python脚本实现数据库备份和上传至阿里云OSS&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;#!/usr/bin/env python
# -*- coding: utf-8 -*-
&lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;oss2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;requests&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;datetime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;host&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;gethostname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;timestr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;datetime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;datetime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;strftime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;%Y%m%d%H%M%S&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;timestamp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/home/www/database/&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;database-xxx-&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;timestr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;.sql.gz&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;system&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/usr/bin/mysqldump -uroot -ppassword database |gzip &amp;gt; &lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;auth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;oss2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Auth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;lt;yourAccessKeyId&amp;gt;&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;lt;yourAccessKeySecret&amp;gt;&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;bucket&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;oss2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;auth&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;http://oss-cn-shenzhen.aliyuncs.com&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;lt;yourBucket&amp;gt;&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;rb&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fileobj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;current&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fileobj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;tell&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;put_object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fileobj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;上传成功&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;2）配置定时任务，每天23:56执行备份。&lt;/p&gt;

&lt;p class=&quot;message message-a&quot;&gt;56 23 * * * python3 /home/alioss.py&lt;/p&gt;

&lt;h2 id=&quot;4php使用sdk上传文件到阿里云oss&quot;&gt;（4）PHP使用SDK上传文件到阿里云OSS&lt;/h2&gt;

&lt;p&gt;上次操作可能有误导致文件上传OSS失败，这次（2019-07-22）便能操作成功了，和Python一样，安装依赖包，复制文档demo。&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;app\tools\controller&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;think\Controller&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;OSS\OssClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;OSS\Core\OssException&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Aliyun&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Controller&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;cd&quot;&gt;/**
     * 阿里云存储上传文件
     * 2019-07-22
     * @return \think\Response
     */&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;upload&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$accessKeyId&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;yourAccessKeyId&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$accessKeySecret&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;yourAccessKeySecret&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$endpoint&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;http://oss-cn-shenzhen.aliyuncs.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$bucket&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;linzening-shenzhen&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 存储空间名称&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$object&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;favicon.ico&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 上传到OSS的保存文件名称及路径&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$filePath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;./favicon.ico&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 本地文件路径&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$ossClient&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;OssClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$accessKeyId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$accessKeySecret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$endpoint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

            &lt;span class=&quot;nv&quot;&gt;$ossClient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;uploadFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$filePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;OssException&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;__FUNCTION__&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;: FAILED&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;__FUNCTION__&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;: OK&quot;&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;cd&quot;&gt;/**
     * 阿里云存储列表
     * 2019-07-22
     * @return \think\Response
     */&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$accessKeyId&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;yourAccessKeyId&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$accessKeySecret&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;yourAccessKeySecret&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$endpoint&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;http://oss-cn-shenzhen.aliyuncs.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$bucket&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;linzening-shenzhen&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 存储空间名称&lt;/span&gt;

        &lt;span class=&quot;nv&quot;&gt;$ossClient&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;OssClient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$accessKeyId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$accessKeySecret&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$endpoint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;nv&quot;&gt;$listObjectInfo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ossClient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;listObjects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;OssException&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;nb&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;__FUNCTION__&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;: FAILED&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;nb&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;// 得到nextMarker，从上一次listObjects读到的最后一个文件的下一个文件开始继续获取文件列表。&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$nextMarker&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$listObjectInfo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getNextMarker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$listObject&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$listObjectInfo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getObjectList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$listPrefix&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$listObjectInfo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getPrefixList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;empty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$listObject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;objectList:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$listObject&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$objectInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$objectInfo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;empty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$listPrefix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;prefixList: &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$listPrefix&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$prefixInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$prefixInfo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getPrefix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$nextMarker&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p class=&quot;message message-b&quot;&gt;upload: OK&lt;/p&gt;

&lt;p&gt;如果是要列举 images 目录下的文件：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$options&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&apos;delimiter&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;/&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&apos;prefix&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;images/&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&apos;max-keys&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;&apos;marker&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$listObjectInfo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ossClient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;listObjects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$bucket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;OssException&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 省略代码...&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;使用阿里云OSS作为文件服务器，需要有上传文件、列举文件列表、下载文件功能，当然你可以使用自己的数据库存储这些列表数据。个人建议，可以设置Referer防盗链，避免其他网站盗用你的图片，减少外网流出流量。&lt;/p&gt;

&lt;h2 id=&quot;5在html中使用javascript上传文件到阿里云oss&quot;&gt;（5）在HTML中使用JavaScript上传文件到阿里云OSS&lt;/h2&gt;

&lt;p&gt;该小结是在2019-08-12补充的，主要为记录上次遗留的问题的解决方案：&lt;/p&gt;

&lt;p&gt;1）如何方便快速的把整个站点上传到OSS，解决办法：&lt;a href=&quot;https://help.aliyun.com/document_detail/61872.html&quot;&gt;图形化管理ossbrowser&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2）如何在Web中直接上传或列举OSS上的文件。&lt;/p&gt;

&lt;p&gt;在这个问题中，我看了阿里云OSS的文档，主要想突破Browser.js SDK的功能，Browser.js就是为了直接用客户端把文件上传至OSS而生。但是试了两天，存在的很多问题：STS权限问题、RAM控制问题（文档没说如何进入安全令牌&lt;子账号授权&gt;，后来工单咨询解决的，RAM权限控制都是json配置，配置了但是响应403，配置不对，基本不清楚到底要配置几个地方），依然没能解决。当时是提交工单问的，但是基本没有想要的回答，感觉工单客服人员都没用过，还要问后端工程师。&lt;/子账号授权&gt;&lt;/p&gt;

&lt;p&gt;在工单后面的回答中，客服说可以直接使用WEB直传，这个也是sts临时授权，比较容易理解操作&lt;a href=&quot;https://help.aliyun.com/document_detail/31925.html&quot;&gt;参考oss-h5-upload-js-direct&lt;/a&gt;。&lt;/p&gt;

&lt;p&gt;首先下了demo测试，这是经过POST上传的，和普通的表单提交一样。&lt;/p&gt;

&lt;p&gt;问题：但该插件仍然不可列举某个目录下的文档。&lt;/p&gt;

&lt;h2 id=&quot;6使阿里云oss支持ipv6-补充时间-2020-08-19&quot;&gt;（6）使阿里云OSS支持IPv6 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;补充时间 2020-08-19&lt;/code&gt;&lt;/h2&gt;

&lt;h5 id=&quot;使用ipv6地址访问oss&quot;&gt;使用IPv6地址访问OSS&lt;/h5&gt;

&lt;p&gt;您的IPv6、IPv4客户端均可以使用OSS提供的统一双栈域名访问您的存储空间。您的DNS服务器将按照您使用的协议版本解析对应协议的OSS服务器地址给您。例如杭州地域的Endpoint为：cn-hangzhou.oss.aliyuncs.com，若您的Bucket名称为myiotdata，则IPv6、IPv4客户端都可通过myiotdata.cn-hangzhou.oss.aliyuncs.com访问。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;目前可以通过IPv6协议访问的Endpoint如下：
华东1（杭州）：cn-hangzhou.oss.aliyuncs.com[2400:3200:1300::92]
华东2（上海）：cn-shanghai.oss.aliyuncs.com[2408:4002:1f10::227]
华北1（青岛）：cn-qingdao.oss.aliyuncs.com[2408:400e:f00::1b0]
华北2（北京）：cn-beijing.oss.aliyuncs.com[2408:4000:200::9c]
华北3（张家口）：cn-zhangjiakou.oss.aliyuncs.com[2408:4001:f30::145]
华北5（呼和浩特）：cn-huhehaote.oss.aliyuncs.com[2408:4004:1f8::a5]
华北6（乌兰察布）：cn-wulanchabu.oss.aliyuncs.com[2408:400b:1f01::1e5]
华南1（深圳）：cn-shenzhen.oss.aliyuncs.com[2408:4003:1f00::1c9]
华南2（河源）：cn-heyuan.oss.aliyuncs.com[2401:b180:6001::17f]
华南3（广州）：cn-guangzhou.oss.aliyuncs.com[2408:400d:1f00::1a9]
西南1（成都）：cn-chengdu.oss.aliyuncs.com[2408:4006:1f10::9e]
华东5（南京）：cn-nanjing.oss.aliyuncs.com -暂无
华东6（福州）：cn-fuzhou.oss.aliyuncs.com -暂无
中国（香港）：cn-hongkong.oss.aliyuncs.com[240b:4001:f00::10a]
杭州金融云：cn-hangzhou-finance.oss.aliyuncs.com[2408:4005:f10::1ec]
上海金融云：cn-shanghai-finance.oss.aliyuncs.com[2408:4002:1f40::67]
深圳金融云：cn-shenzhen-finance.oss.aliyuncs.com[2408:4003:1f30::102]
新加坡：ap-southeast-1.oss.aliyuncs.com[240b:4000:f10::136](2024年2月4日)
德国（法兰克福）：eu-central-1.oss.aliyuncs.com[240b:4005:f00::ed](2025年11月22日)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;备注：从贵州到阿里云香港节点的IPv6绕路，导致访问较慢。[2021/06/07]&lt;/li&gt;
  &lt;li&gt;广州、成都、青岛、张家口、乌兰察布、河源OSS IPv6开通时间2021年11月18日&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href=&quot;https://help.aliyun.com/document_detail/31834.html?spm=a2c4g.11186623.6.613.46b26ab3fixgBh&quot;&gt;使用IPv6地址访问OSS&lt;/a&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;blockquote&gt;
  &lt;p&gt;总结：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;（1）测试阿里OSS的下载速度达到 5-10M/s，完全达到各种下载需求。&lt;/p&gt;

&lt;p&gt;（2）计费（标准型为例）：数据存储，0.12元/GB/月；外网流出流量，0.5元/GB；如果使用CDN的话：CDN回源流出流量0.15元/GB；请求费用0.01元/万次&lt;/p&gt;

&lt;p&gt;（3）应用场景：数据库备份选择&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;归档存储类型&lt;/code&gt;，费用基本为0，要下载文件需要提前解冻；提供HTTP服务选择&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;标准存储类型&lt;/code&gt;，例如提供静态Web服务、提供文件下载。&lt;/p&gt;

&lt;p&gt;（4）使用阿里云OSS的好处：提供HTTP服务、下载网速快、价格便宜、安全性高、无需迁移、管理方便（不需要后台程序，可直接使用SDK管理）。&lt;/p&gt;

&lt;p&gt;（5）遗留问题：如何方便快速的把整个站点上传到OSS，并且文件目录结构不变。&lt;/p&gt;

&lt;p&gt;（6）缺点：文档复杂、授权过程复杂。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;参考文章：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://www.jianshu.com/p/c001ac7cdf21&quot;&gt;使用阿里云OSS+CDN部署前端页面与加速静态资源&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://help.aliyun.com/document_detail/31872.html&quot;&gt;配置静态网站托管&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://help.aliyun.com/document_detail/88510.html?spm=a2c4g.11186623.6.1035.1bb96b46XQtKPW&quot;&gt;列举文件&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>10分钟创建一个DNS服务器</title>
   <link href="https://comeround.cn/article/ten-minites-build-a-dns-server.html"/>
   <updated>2019-07-13T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/ten-minites-build-a-dns-server</id>
   <content type="html">&lt;p class=&quot;message message-a&quot;&gt;我不是运维人员，但是我可以10分钟搭建一个DNS服务器。&lt;/p&gt;

&lt;h3 id=&quot;1安装&quot;&gt;（1）安装&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;yum install bind -y
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;2服务器配置&quot;&gt;（2）服务器配置&lt;/h3&gt;

&lt;p&gt;vim /etc/named.rfc1912.zones&lt;/p&gt;

&lt;div class=&quot;language-conf highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;zone&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;me.ayouleyang.cn&quot;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;IN&lt;/span&gt; {
        &lt;span class=&quot;n&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;master&lt;/span&gt;;
        &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;me.ayouleyang.cn&quot;&lt;/span&gt;;
        &lt;span class=&quot;n&quot;&gt;allow&lt;/span&gt;-&lt;span class=&quot;n&quot;&gt;update&lt;/span&gt; { &lt;span class=&quot;n&quot;&gt;none&lt;/span&gt;; };
};
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/var/named&lt;/code&gt; 目录添加文件 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;me.ayouleyang.cn&lt;/code&gt;，并修改权限:&lt;/p&gt;

&lt;div class=&quot;language-conf highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$&lt;span class=&quot;n&quot;&gt;TTL&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;D&lt;/span&gt;
@	&lt;span class=&quot;n&quot;&gt;IN&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SOA&lt;/span&gt;	@ &lt;span class=&quot;n&quot;&gt;rname&lt;/span&gt;.&lt;span class=&quot;n&quot;&gt;invalid&lt;/span&gt;. (
					&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;	; &lt;span class=&quot;n&quot;&gt;serial&lt;/span&gt;
					&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;D&lt;/span&gt;	; &lt;span class=&quot;n&quot;&gt;refresh&lt;/span&gt;
					&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;H&lt;/span&gt;	; &lt;span class=&quot;n&quot;&gt;retry&lt;/span&gt;
					&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;W&lt;/span&gt;	; &lt;span class=&quot;n&quot;&gt;expire&lt;/span&gt;
					&lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;H&lt;/span&gt; )	; &lt;span class=&quot;n&quot;&gt;minimum&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;NS&lt;/span&gt;	@
@       &lt;span class=&quot;n&quot;&gt;IN&lt;/span&gt;      &lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;   &lt;span class=&quot;m&quot;&gt;114&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;114&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;114&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;114&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;www&lt;/span&gt;     &lt;span class=&quot;n&quot;&gt;IN&lt;/span&gt;      &lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;   &lt;span class=&quot;m&quot;&gt;39&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;106&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;210&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;153&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ipv6&lt;/span&gt;	&lt;span class=&quot;n&quot;&gt;IN&lt;/span&gt;	&lt;span class=&quot;n&quot;&gt;AAAA&lt;/span&gt;	&lt;span class=&quot;n&quot;&gt;fe80&lt;/span&gt;::&lt;span class=&quot;m&quot;&gt;107&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;:&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b5d&lt;/span&gt;:&lt;span class=&quot;m&quot;&gt;1458&lt;/span&gt;:&lt;span class=&quot;n&quot;&gt;bbc7&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;修改权限命令为：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chown root.named me.ayouleyang.cn&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;配置为：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;me.ayouleyang.cn 解析到 114.114.114.114&lt;/li&gt;
  &lt;li&gt;www.me.ayouleyang.cn 解析到 39.106.210.153&lt;/li&gt;
  &lt;li&gt;ipv6.me.ayouleyang.cn 解析到 fe80::107f:2b5d:1458:bbc7&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;3购买域名及配置&quot;&gt;（3）购买域名及配置&lt;/h3&gt;

&lt;p&gt;您可以直接修改购买的域名的 NS 记录，一级域名直接使用自己的DNS服务器解析：&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/dns.aliyun.ns.edit.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;本实验是修改二级域名NS：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;dns.ayouleyang.cn 解析到A记录 134.175.146.38&lt;/li&gt;
  &lt;li&gt;me.ayouleyang.cn 解析到NS记录 dns.ayouleyang.cn&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;4本地测试&quot;&gt;（4）本地测试&lt;/h3&gt;

&lt;p&gt;（1）修改&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/resolv.conf&lt;/code&gt;，使用DNS服务器为本机&lt;/p&gt;

&lt;div class=&quot;language-conf highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;timeout&lt;/span&gt;:&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rotate&lt;/span&gt;
;&lt;span class=&quot;n&quot;&gt;nameserver&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;183&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;60&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;83&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;19&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;nameserver&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;127&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（2）测试&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@test named]# dig me.ayouleyang.cn

; &amp;lt;&amp;lt;&amp;gt;&amp;gt; DiG 9.9.4-RedHat-9.9.4-74.el7_6.1 &amp;lt;&amp;lt;&amp;gt;&amp;gt; me.ayouleyang.cn
;; global options: +cmd
;; Got answer:
;; -&amp;gt;&amp;gt;HEADER&amp;lt;&amp;lt;- opcode: QUERY, status: NOERROR, id: 3594
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;me.ayouleyang.cn.		IN	A

;; ANSWER SECTION:
me.ayouleyang.cn.	86400	IN	A	114.114.114.114

;; AUTHORITY SECTION:
me.ayouleyang.cn.	86400	IN	NS	me.ayouleyang.cn.

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sat Jul 13 22:28:15 CST 2019
;; MSG SIZE  rcvd: 75
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@test named]# dig www.me.ayouleyang.cn

; &amp;lt;&amp;lt;&amp;gt;&amp;gt; DiG 9.9.4-RedHat-9.9.4-74.el7_6.1 &amp;lt;&amp;lt;&amp;gt;&amp;gt; www.me.ayouleyang.cn
;; global options: +cmd
;; Got answer:
;; -&amp;gt;&amp;gt;HEADER&amp;lt;&amp;lt;- opcode: QUERY, status: NOERROR, id: 58574
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.me.ayouleyang.cn.		IN	A

;; ANSWER SECTION:
www.me.ayouleyang.cn.	86400	IN	A	39.106.210.153

;; AUTHORITY SECTION:
me.ayouleyang.cn.	86400	IN	NS	me.ayouleyang.cn.

;; ADDITIONAL SECTION:
me.ayouleyang.cn.	86400	IN	A	114.114.114.114

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sat Jul 13 22:33:18 CST 2019
;; MSG SIZE  rcvd: 95
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;nslookup测试&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@test named]# nslookup - 127.0.0.1
&amp;gt; me.ayouleyang.cn
Server:		127.0.0.1
Address:	127.0.0.1#53

Name:	me.ayouleyang.cn
Address: 114.114.114.114
&amp;gt; www.me.ayouleyang.cn
Server:		127.0.0.1
Address:	127.0.0.1#53

Name:	www.me.ayouleyang.cn
Address: 39.106.210.153
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;5外部访问&quot;&gt;（5）外部访问&lt;/h3&gt;

&lt;p&gt;如果这一步能成功，该解析即能对外服务。&lt;/p&gt;

&lt;p&gt;1）配置 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;named.conf&lt;/code&gt;，一直没注意named的配置，需要把localhost改为any，（注意：不是0.0.0.0）&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@test named]# cat /etc/named.conf
options {
	listen-on port 53 { any; };
	listen-on-v6 port 53 { any; };
	directory 	&quot;/var/named&quot;;
	dump-file 	&quot;/var/named/data/cache_dump.db&quot;;
	statistics-file &quot;/var/named/data/named_stats.txt&quot;;
	memstatistics-file &quot;/var/named/data/named_mem_stats.txt&quot;;
	recursing-file  &quot;/var/named/data/named.recursing&quot;;
	secroots-file   &quot;/var/named/data/named.secroots&quot;;
	allow-query     { any; };
	/* 省略部分代码 */
};
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;2）测试：使用其他机器ping该域名&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@master ~]# ping www.me.ayouleyang.cn
PING www.me.ayouleyang.cn (39.106.210.153) 56(84) bytes of data.
64 bytes from 39.106.210.153 (39.106.210.153): icmp_seq=1 ttl=54 time=37.1 ms
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;C:\Users\lite&amp;gt;ping ipv6.me.ayouleyang.cn -6

正在 Ping ipv6.me.ayouleyang.cn [fe80::107f:2b5d:1458:bbc7%3] 具有 32 字节的数据:
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;3）此时，该DNS服务器既是权威DNS服务器，又是DNS缓存服务器，如同：114.114.114.114、119.29.29.29、及localDNS。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;参考文档：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://www.cnblogs.com/linuxde/p/8715659.html&quot;&gt;CentOS 搭建dns服务器 解析任意域名&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.cnblogs.com/luoahong/p/7859000.html&quot;&gt;Linux运维实战之DNS（bind）服务器的安装与配置&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.cnblogs.com/heiye123/articles/7687922.html&quot;&gt;DNS服务器搭建与配置&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>抓了个IPv6包</title>
   <link href="https://comeround.cn/article/catch-a-ipv6-package.html"/>
   <updated>2019-07-05T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/catch-a-ipv6-package</id>
   <content type="html">&lt;p&gt;        最近百度云发布了BCC服务器 IPv6支持，就试着搭起了一个，&lt;a href=&quot;/article/baidu-bcc-ipv6.html&quot;&gt;百度智能云IPv6搭建LNMP站点&lt;/a&gt;，刚好，最近在学习CentOS7 tcpdump抓包，参考IPv4抓包过程，写个这个IPv6抓包文档。您也可以查看这篇关于 IPv6 的文章：&lt;a href=&quot;/article/ipv6-note.html&quot;&gt;IPv6笔记&lt;/a&gt;。&lt;/p&gt;

&lt;h2 id=&quot;一ipv4的http请求包&quot;&gt;（一）IPv4的HTTP请求包&lt;/h2&gt;

&lt;p&gt;在抓 IPv6 包之前，先来抓个 IPv4 包，反正不要钱。&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1.204.29.213.10484 &amp;gt; 172.17.27.211.http: Flags [P.], cksum 0x5580 (correct), seq 1:517, ack 1, win 258, length 516: HTTP, length: 516
GET /?plat=pc HTTP/1.1

0x0000:  4514 022c 1ddf 4000 7306 0054 01cc 1dd5  E..,..@.s..T....
0x0010:  ac11 1bd3 28f4 0050 fb41 fd3f 7716 0212  ....(..P.A.?w...
0x0020:  5018 0102 5580 0000 4745 5420 2f3f 706c  P...U...GET./?pl
0x0030:  6174 3d70 6320 4854 5450 2f31 2e31 0d0a  at=pc.HTTP/1.1..
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;前面一行：说明了这个数据包是从 1.204.29.213 的10484端口发送到 172.17.27.211 的80端口，是HTTP的请求包，后面是TCP头部信息。&lt;/li&gt;
  &lt;li&gt;（IP解析）每一行占16字节。第一行4514的4代表IPv4，5表示该IP头只有20字节，没有选项，14即为TOS。022c表示数据总长度（2*256+32+12=512+44=556），7306 0054：73为TTL，06为TCP协议(协议编号&lt;sup id=&quot;fnref:pn&quot;&gt;&lt;a href=&quot;#fn:pn&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;)，0054为头部校验和。后两段为源地址，01cc 1dd5为源地址1.204.29.213；第二行前两段为目的地址，ac11 1bd3即目的地址为172.17.27.211。&lt;/li&gt;
  &lt;li&gt;（TCP解析）第二行第三段第四段表示源端口和目的端口：28f4 0050，源端口为28f4（10484），目的端口为50（80）。fb41 fd3f 7716 0212前两段是seq号，后两段是ack号（自己去转换进制）。&lt;/li&gt;
  &lt;li&gt;第三行：5018，5表示5个32bit(这个TCP头大小是5*4=20个字节，10段) ，0是保留，18是标志位，对应tcpdump中的flag。&lt;/li&gt;
  &lt;li&gt;0102这个是数据窗口大小（10进制258），TCP流量控制关键的技术手段就是这个，具体什么意思我也不知道。5580校验和，不管他。0000这个通常和“标志位”配合使用，标志位设置URG (0x20)表示开启“紧急数据”，这个字段就是“紧急数据的序号”。&lt;/li&gt;
  &lt;li&gt;（HTTP解析）4745 5420 2f3f 706c 6174 3d70，从这个部分开始，是HTTP解析内容，这里解出“GET /?plat=pc HTTP/1.1”，不用解释了吧。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;二ipv6的http包&quot;&gt;（二）IPv6的HTTP包&lt;/h2&gt;

&lt;p&gt;抓包命令&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;tcpdump -X -i eth0 -vvvv -n port 80
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;1第一段包三次握手&quot;&gt;（1）第一段包：三次握手&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;18:33:03.960296 IP6 (hlim 236, next-header TCP (6) payload length: 40) 2409:896a:430:773c:2:1:a23d:5414.41535 &amp;gt; 240c:4082:0:1e03::5.http: Flags [S], cksum 0xdedb (correct), seq 1463932929, win 65535, options [mss 1350,sackOK,TS val 15594760 ecr 0,nop,wscale 6], length 0
	0x0000:  6000 0000 0028 06ec 2409 896a 0430 773c  `....(..$..j.0w&amp;lt;
	0x0010:  0002 0001 a23d 5414 240c 4082 0000 1e03  .....=T.$.@.....
	0x0020:  0000 0000 0000 0005 a23f 0050 5741 d801  .........?.PWA..
	0x0030:  0000 0000 a002 ffff dedb 0000 0204 0546  ...............F
	0x0040:  0402 080a 00ed f508 0000 0000 0103 0306  ................
18:33:03.960360 IP6 (hlim 64, next-header TCP (6) payload length: 40) 240c:4082:0:1e03::5.http &amp;gt; 2409:896a:430:773c:2:1:a23d:5414.41535: Flags [S.], cksum 0xa1f9 (incorrect -&amp;gt; 0x14ae), seq 398543506, ack 1463932930, win 28560, options [mss 1440,sackOK,TS val 6092673 ecr 15594760,nop,wscale 7], length 0
	0x0000:  6000 0000 0028 0640 240c 4082 0000 1e03  `....(.@$.@.....
	0x0010:  0000 0000 0000 0005 2409 896a 0430 773c  ........$..j.0w&amp;lt;
	0x0020:  0002 0001 a23d 5414 0050 a23f 17c1 4a92  .....=T..P.?..J.
	0x0030:  5741 d802 a012 6f90 a1f9 0000 0204 05a0  WA....o.........
	0x0040:  0402 080a 005c f781 00ed f508 0103 0307  .....\..........
18:33:04.029632 IP6 (hlim 236, next-header TCP (6) payload length: 32) 2409:896a:430:773c:2:1:a23d:5414.41535 &amp;gt; 240c:4082:0:1e03::5.http: Flags [.], cksum 0xadfd (correct), seq 1, ack 1, win 1266, options [nop,nop,TS val 15594767 ecr 6092673], length 0
	0x0000:  6000 0000 0020 06ec 2409 896a 0430 773c  `.......$..j.0w&amp;lt;
	0x0010:  0002 0001 a23d 5414 240c 4082 0000 1e03  .....=T.$.@.....
	0x0020:  0000 0000 0000 0005 a23f 0050 5741 d802  .........?.PWA..
	0x0030:  17c1 4a93 8010 04f2 adfd 0000 0101 080a  ..J.............
	0x0040:  00ed f50f 005c f781                      .....\..
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;第一个握手包：
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;6000 0000 0028 06ec&lt;/code&gt;：6即IP版本IPv6，后面00为流量类型，00000为流标签，0028 0有效载荷长度640，6为下一报头，ec为跳数限制236。&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2409 896a 0430 773c 0002 0001 a23d 5414&lt;/code&gt;：即为源IPv6地址。&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;240c 4082 0000 1e03 0000 0000 0000 0005&lt;/code&gt;：为目的IPv6地址。&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a23f 0050&lt;/code&gt;：a23f为源端口41535，0050为目的端口80。&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;5741 d801 0000 0000&lt;/code&gt;：前两段是seq号1463932929，后两段0000 0000即没有ack。&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a002 ffff dedb 0000&lt;/code&gt;：（这一段能拆分就行了）a为偏移量，002即二进制0000 0000 0010，即标志位SYN为1，ffff为窗口字段，dedb为校验和，0000紧急指针。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;第二个握手包：
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;17c1 4a92 5741 d802&lt;/code&gt;：seq号为398543506，ack号为1463932930&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;第三个握手包：
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;5741 d802 17c1 4a93&lt;/code&gt;：seq号为1463932930，ack号为398543507&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;2第二段包http请求&quot;&gt;（2）第二段包：HTTP请求&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;18:33:04.314851 IP6 (hlim 236, next-header TCP (6) payload length: 502) 2409:896a:430:773c:2:1:a23d:5414.41535 &amp;gt; 240c:4082:0:1e03::5.http: Flags [P.], cksum 0xafad (correct), seq 1:471, ack 1, win 1266, options [nop,nop,TS val 15594795 ecr 6092673], length 470: HTTP, length: 470
	GET /?t=4 HTTP/1.1
	Host: ipv6.ayouleyang.cn
	Connection: keep-alive
	Upgrade-Insecure-Requests: 1
	User-Agent: Mozilla/5.0 (Linux; Android 6.0; 1505-A01 Build/MRA58K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/62.0.3202.97 Mobile Safari/537.36
	Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
	Accept-Encoding: gzip, deflate
	Accept-Language: zh-CN,en-US;q=0.9
	Cookie: _ga=GA1.2.142392291.1560353173

	0x0000:  6000 0000 01f6 06ec 2409 896a 0430 773c  `.......$..j.0w&amp;lt;
	0x0010:  0002 0001 a23d 5414 240c 4082 0000 1e03  .....=T.$.@.....
	0x0020:  0000 0000 0000 0005 a23f 0050 5741 d802  .........?.PWA..
	0x0030:  17c1 4a93 8018 04f2 afad 0000 0101 080a  ..J.............
	0x0040:  00ed f52b 005c f781 4745 5420 2f3f 743d  ...+.\..GET./?t=
	0x0050:  3420 4854 5450 2f31 2e31 0d0a 486f 7374  4.HTTP/1.1..Host
	0x0060:  3a20 6970 7636 2e61 796f 756c 6579 616e  :.ipv6.ayouleyan
	0x0070:  672e 636e 0d0a 436f 6e6e 6563 7469 6f6e  g.cn..Connection
	0x0080:  3a20 6b65 6570 2d61 6c69 7665 0d0a 5570  :.keep-alive..Up
	0x0090:  6772 6164 652d 496e 7365 6375 7265 2d52  grade-Insecure-R
	0x00a0:  6571 7565 7374 733a 2031 0d0a 5573 6572  equests:.1..User
	0x00b0:  2d41 6765 6e74 3a20 4d6f 7a69 6c6c 612f  -Agent:.Mozilla/
	0x00c0:  352e 3020 284c 696e 7578 3b20 416e 6472  5.0.(Linux;.Andr
	0x00d0:  6f69 6420 362e 303b 2031 3530 352d 4130  oid.6.0;.1505-A0
	0x00e0:  3120 4275 696c 642f 4d52 4135 384b 3b20  1.Build/MRA58K;.
	0x00f0:  7776 2920 4170 706c 6557 6562 4b69 742f  wv).AppleWebKit/
	0x0100:  3533 372e 3336 2028 4b48 544d 4c2c 206c  537.36.(KHTML,.l
	0x0110:  696b 6520 4765 636b 6f29 2056 6572 7369  ike.Gecko).Versi
	0x0120:  6f6e 2f34 2e30 2043 6872 6f6d 652f 3632  on/4.0.Chrome/62
	0x0130:  2e30 2e33 3230 322e 3937 204d 6f62 696c  .0.3202.97.Mobil
	0x0140:  6520 5361 6661 7269 2f35 3337 2e33 360d  e.Safari/537.36.
	0x0150:  0a41 6363 6570 743a 2074 6578 742f 6874  .Accept:.text/ht
	0x0160:  6d6c 2c61 7070 6c69 6361 7469 6f6e 2f78  ml,application/x
	0x0170:  6874 6d6c 2b78 6d6c 2c61 7070 6c69 6361  html+xml,applica
	0x0180:  7469 6f6e 2f78 6d6c 3b71 3d30 2e39 2c69  tion/xml;q=0.9,i
	0x0190:  6d61 6765 2f77 6562 702c 696d 6167 652f  mage/webp,image/
	0x01a0:  6170 6e67 2c2a 2f2a 3b71 3d30 2e38 0d0a  apng,*/*;q=0.8..
	0x01b0:  4163 6365 7074 2d45 6e63 6f64 696e 673a  Accept-Encoding:
	0x01c0:  2067 7a69 702c 2064 6566 6c61 7465 0d0a  .gzip,.deflate..
	0x01d0:  4163 6365 7074 2d4c 616e 6775 6167 653a  Accept-Language:
	0x01e0:  207a 682d 434e 2c65 6e2d 5553 3b71 3d30  .zh-CN,en-US;q=0
	0x01f0:  2e39 0d0a 436f 6f6b 6965 3a20 5f67 613d  .9..Cookie:._ga=
	0x0200:  4741 312e 322e 3134 3233 3932 3239 312e  GA1.2.142392291.
	0x0210:  3135 3630 3335 3331 3733 0d0a 0d0a       1560353173....
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;6000 0000 01f6 06ec&lt;/code&gt;：6即IP版本IPv6，后面00为流量类型，00000为流标签，01f6 0有效载荷长度xxx，6为下一报头，ec为跳数限制236。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2409 896a 0430 773c 0002 0001 a23d 5414&lt;/code&gt;：即为源IPv6地址。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;240c 4082 0000 1e03 0000 0000 0000 0005&lt;/code&gt;：为目的IPv6地址。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;a23f 0050&lt;/code&gt;：a23f为源端口41535，0050为目的端口80。&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;5741 d802 17c1 4a93&lt;/code&gt;：前两段是seq号1463932930，后两段ack为398543507。&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;3第三段包未知&quot;&gt;（3）第三段包：未知&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;18:33:04.314899 IP6 (hlim 64, next-header TCP (6) payload length: 32) 240c:4082:0:1e03::5.http &amp;gt; 2409:896a:430:773c:2:1:a23d:5414.41535: Flags [.], cksum 0xa1f1 (incorrect -&amp;gt; 0xaeb2), seq 1, ack 471, win 232, options [nop,nop,TS val 6093028 ecr 15594795], length 0
	0x0000:  6000 0000 0020 0640 240c 4082 0000 1e03  `......@$.@.....
	0x0010:  0000 0000 0000 0005 2409 896a 0430 773c  ........$..j.0w&amp;lt;
	0x0020:  0002 0001 a23d 5414 0050 a23f 17c1 4a93  .....=T..P.?..J.
	0x0030:  5741 d9d8 8010 00e8 a1f1 0000 0101 080a  WA..............
	0x0040:  005c f8e4 00ed f52b                      .\.....+
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;4第四段包http响应&quot;&gt;（4）第四段包：HTTP响应&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;18:33:04.315390 IP6 (hlim 64, next-header TCP (6) payload length: 641) 240c:4082:0:1e03::5.http &amp;gt; 2409:896a:430:773c:2:1:a23d:5414.41535: Flags [P.], cksum 0xa452 (incorrect -&amp;gt; 0x49f8), seq 1:610, ack 471, win 232, options [nop,nop,TS val 6093028 ecr 15594795], length 609: HTTP, length: 609
	HTTP/1.1 200 OK
	Server: nginx/1.12.2
	Date: Sat, 06 Jul 2019 10:33:04 GMT
	Content-Type: text/html
	Content-Length: 371
	Last-Modified: Sat, 06 Jul 2019 09:32:38 GMT
	Connection: keep-alive
	ETag: &quot;5d206ab6-173&quot;
	Accept-Ranges: bytes

	&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
	&amp;lt;head&amp;gt;
	&amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;
	0x0000:  6000 0000 0281 0640 240c 4082 0000 1e03  `......@$.@.....
	0x0010:  0000 0000 0000 0005 2409 896a 0430 773c  ........$..j.0w&amp;lt;
	0x0020:  0002 0001 a23d 5414 0050 a23f 17c1 4a93  .....=T..P.?..J.
	0x0030:  5741 d9d8 8018 00e8 a452 0000 0101 080a  WA.......R......
	0x0040:  005c f8e4 00ed f52b 4854 5450 2f31 2e31  .\.....+HTTP/1.1
	0x0050:  2032 3030 204f 4b0d 0a53 6572 7665 723a  .200.OK..Server:
	0x0060:  206e 6769 6e78 2f31 2e31 322e 320d 0a44  .nginx/1.12.2..D
	0x0070:  6174 653a 2053 6174 2c20 3036 204a 756c  ate:.Sat,.06.Jul
	0x0080:  2032 3031 3920 3130 3a33 333a 3034 2047  .2019.10:33:04.G
	0x0090:  4d54 0d0a 436f 6e74 656e 742d 5479 7065  MT..Content-Type
	0x00a0:  3a20 7465 7874 2f68 746d 6c0d 0a43 6f6e  :.text/html..Con
	0x00b0:  7465 6e74 2d4c 656e 6774 683a 2033 3731  tent-Length:.371
	0x00c0:  0d0a 4c61 7374 2d4d 6f64 6966 6965 643a  ..Last-Modified:
	0x00d0:  2053 6174 2c20 3036 204a 756c 2032 3031  .Sat,.06.Jul.201
	0x00e0:  3920 3039 3a33 323a 3338 2047 4d54 0d0a  9.09:32:38.GMT..
	0x00f0:  436f 6e6e 6563 7469 6f6e 3a20 6b65 6570  Connection:.keep
	0x0100:  2d61 6c69 7665 0d0a 4554 6167 3a20 2235  -alive..ETag:.&quot;5
	0x0110:  6432 3036 6162 362d 3137 3322 0d0a 4163  d206ab6-173&quot;..Ac
	0x0120:  6365 7074 2d52 616e 6765 733a 2062 7974  cept-Ranges:.byt
	0x0130:  6573 0d0a 0d0a 3c68 746d 6c20 786d 6c6e  es....&amp;lt;html.xmln
	0x0140:  733d 2268 7474 703a 2f2f 7777 772e 7733  s=&quot;http://www.w3
	0x0150:  2e6f 7267 2f31 3939 392f 7868 746d 6c22  .org/1999/xhtml&quot;
	0x0160:  3e0a 3c68 6561 643e 0a3c 6d65 7461 2063  &amp;gt;.&amp;lt;head&amp;gt;.&amp;lt;meta.c
	0x0170:  6861 7273 6574 3d22 7574 662d 3822 3e0a  harset=&quot;utf-8&quot;&amp;gt;.
	0x0180:  3c74 6974 6c65 3ee7 bd91 e7ab 99e5 bbba  &amp;lt;title&amp;gt;.........
	0x0190:  e8ae bee4 b8ad 3c2f 7469 746c 653e 0a3c  ......&amp;lt;/title&amp;gt;.&amp;lt;
	0x01a0:  6d65 7461 2068 7474 702d 6571 7569 763d  meta.http-equiv=
	0x01b0:  2258 2d55 412d 436f 6d70 6174 6962 6c65  &quot;X-UA-Compatible
	0x01c0:  2220 636f 6e74 656e 743d 2249 453d 6564  &quot;.content=&quot;IE=ed
	0x01d0:  6765 223e 0a3c 6d65 7461 206e 616d 653d  ge&quot;&amp;gt;.&amp;lt;meta.name=
	0x01e0:  2276 6965 7770 6f72 7422 2063 6f6e 7465  &quot;viewport&quot;.conte
	0x01f0:  6e74 3d22 7769 6474 683d 6465 7669 6365  nt=&quot;width=device
	0x0200:  2d77 6964 7468 2c20 696e 6974 6961 6c2d  -width,.initial-
	0x0210:  7363 616c 653d 3122 3e0a 3c2f 6865 6164  scale=1&quot;&amp;gt;.&amp;lt;/head
	0x0220:  3e0a 3c62 6f64 793e 0a3c 7020 616c 6967  &amp;gt;.&amp;lt;body&amp;gt;.&amp;lt;p.alig
	0x0230:  6e3d 2263 656e 7465 7222 2073 7479 6c65  n=&quot;center&quot;.style
	0x0240:  3d22 666f 6e74 2d73 697a 653a 3238 7078  =&quot;font-size:28px
	0x0250:  3b20 666f 6e74 2d77 6569 6768 743a 626f  ;.font-weight:bo
	0x0260:  6c64 3b6d 6172 6769 6e2d 746f 703a 3530  ld;margin-top:50
	0x0270:  7078 3b22 3ee7 b3bb e7bb 9fe7 bbb4 e68a  px;&quot;&amp;gt;...........
	0x0280:  a4e4 b8ad 20e6 95ac e8af b7e6 9c9f e5be  ................
	0x0290:  85ef bc81 3c2f 703e 0a3c 2f62 6f64 793e  ....&amp;lt;/p&amp;gt;.&amp;lt;/body&amp;gt;
	0x02a0:  0a3c 2f68 746d 6c3e 0a                   .&amp;lt;/html&amp;gt;.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;附：服务器上 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/index.html&lt;/code&gt; 的内容&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;
&amp;lt;title&amp;gt;网站建设中&amp;lt;/title&amp;gt;
&amp;lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&amp;gt;
&amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;p align=&quot;center&quot; style=&quot;font-size:28px; font-weight:bold;margin-top:50px;&quot;&amp;gt;系统维护中 敬请期待！&amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;第五段包未知根据tcp协议不是四次挥手&quot;&gt;第五段包：（未知，根据TCP协议，不是四次挥手）&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;18:33:04.389347 IP6 (hlim 236, next-header TCP (6) payload length: 32) 2409:896a:430:773c:2:1:a23d:5414.41535 &amp;gt; 240c:4082:0:1e03::5.http: Flags [.], cksum 0xa819 (correct), seq 471, ack 610, win 1304, options [nop,nop,TS val 15594803 ecr 6093028], length 0
	0x0000:  6000 0000 0020 06ec 2409 896a 0430 773c  `.......$..j.0w&amp;lt;
	0x0010:  0002 0001 a23d 5414 240c 4082 0000 1e03  .....=T.$.@.....
	0x0020:  0000 0000 0000 0005 a23f 0050 5741 d9d8  .........?.PWA..
	0x0030:  17c1 4cf4 8010 0518 a819 0000 0101 080a  ..L.............
	0x0040:  00ed f533 005c f8e4                      ...3.\..
18:33:04.729402 IP6 (hlim 236, next-header TCP (6) payload length: 40) 2409:896a:430:773c:2:1:a23d:5414.41534 &amp;gt; 240c:4082:0:1e03::5.http: Flags [S], cksum 0x6b12 (correct), seq 1812936370, win 65535, options [mss 1350,sackOK,TS val 15594836 ecr 0,nop,wscale 6], length 0
	0x0000:  6000 0000 0028 06ec 2409 896a 0430 773c  `....(..$..j.0w&amp;lt;
	0x0010:  0002 0001 a23d 5414 240c 4082 0000 1e03  .....=T.$.@.....
	0x0020:  0000 0000 0000 0005 a23e 0050 6c0f 36b2  .........&amp;gt;.Pl.6.
	0x0030:  0000 0000 a002 ffff 6b12 0000 0204 0546  ........k......F
	0x0040:  0402 080a 00ed f554 0000 0000 0103 0306  .......T........
18:33:04.729453 IP6 (hlim 64, next-header TCP (6) payload length: 40) 240c:4082:0:1e03::5.http &amp;gt; 2409:896a:430:773c:2:1:a23d:5414.41534: Flags [S.], cksum 0xa1f9 (incorrect -&amp;gt; 0xf40f), seq 3910738701, ack 1812936371, win 28560, options [mss 1440,sackOK,TS val 6093442 ecr 15594836,nop,wscale 7], length 0
	0x0000:  6000 0000 0028 0640 240c 4082 0000 1e03  `....(.@$.@.....
	0x0010:  0000 0000 0000 0005 2409 896a 0430 773c  ........$..j.0w&amp;lt;
	0x0020:  0002 0001 a23d 5414 0050 a23e e919 230d  .....=T..P.&amp;gt;..#.
	0x0030:  6c0f 36b3 a012 6f90 a1f9 0000 0204 05a0  l.6...o.........
	0x0040:  0402 080a 005c fa82 00ed f554 0103 0307  .....\.....T....
18:33:04.799463 IP6 (hlim 236, next-header TCP (6) payload length: 32) 2409:896a:430:773c:2:1:a23d:5414.41534 &amp;gt; 240c:4082:0:1e03::5.http: Flags [.], cksum 0x8d5e (correct), seq 1, ack 1, win 1266, options [nop,nop,TS val 15594844 ecr 6093442], length 0
	0x0000:  6000 0000 0020 06ec 2409 896a 0430 773c  `.......$..j.0w&amp;lt;
	0x0010:  0002 0001 a23d 5414 240c 4082 0000 1e03  .....=T.$.@.....
	0x0020:  0000 0000 0000 0005 a23e 0050 6c0f 36b3  .........&amp;gt;.Pl.6.
	0x0030:  e919 230e 8010 04f2 8d5e 0000 0101 080a  ..#......^......
	0x0040:  00ed f55c 005c fa82                      ...\.\..
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;第六段http其他请求&quot;&gt;第六段：HTTP其他请求&lt;/h3&gt;

&lt;p&gt;大家都知道，浏览器会默认发一个&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/favicon.ico&lt;/code&gt;的请求，用于获取网页的图标。（如果你不懂的话，你就当你已经懂了。）以下是为该文件的请求与响应。&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;说明一下：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/404.html&lt;/code&gt;文件漏掉了&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;html&amp;gt;&lt;/code&gt;标签了&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;18:33:05.634355 IP6 (hlim 236, next-header TCP (6) payload length: 474) 2409:896a:430:773c:2:1:a23d:5414.41535 &amp;gt; 240c:4082:0:1e03::5.http: Flags [P.], cksum 0x3606 (correct), seq 471:913, ack 610, win 1304, options [nop,nop,TS val 15594926 ecr 6093028], length 442: HTTP, length: 442
	GET /favicon.ico HTTP/1.1
	Host: ipv6.ayouleyang.cn
	Connection: keep-alive
	User-Agent: Mozilla/5.0 (Linux; Android 6.0; 1505-A01 Build/MRA58K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/62.0.3202.97 Mobile Safari/537.36
	Accept: image/webp,image/apng,image/*,*/*;q=0.8
	Referer: http://ipv6.ayouleyang.cn/?t=4
	Accept-Encoding: gzip, deflate
	Accept-Language: zh-CN,en-US;q=0.9
	Cookie: _ga=GA1.2.142392291.1560353173

	0x0000:  6000 0000 01da 06ec 2409 896a 0430 773c  `.......$..j.0w&amp;lt;
	0x0010:  0002 0001 a23d 5414 240c 4082 0000 1e03  .....=T.$.@.....
	0x0020:  0000 0000 0000 0005 a23f 0050 5741 d9d8  .........?.PWA..
	0x0030:  17c1 4cf4 8018 0518 3606 0000 0101 080a  ..L.....6.......
	0x0040:  00ed f5ae 005c f8e4 4745 5420 2f66 6176  .....\..GET./fav
	0x0050:  6963 6f6e 2e69 636f 2048 5454 502f 312e  icon.ico.HTTP/1.
	0x0060:  310d 0a48 6f73 743a 2069 7076 362e 6179  1..Host:.ipv6.ay
	0x0070:  6f75 6c65 7961 6e67 2e63 6e0d 0a43 6f6e  ouleyang.cn..Con
	0x0080:  6e65 6374 696f 6e3a 206b 6565 702d 616c  nection:.keep-al
	0x0090:  6976 650d 0a55 7365 722d 4167 656e 743a  ive..User-Agent:
	0x00a0:  204d 6f7a 696c 6c61 2f35 2e30 2028 4c69  .Mozilla/5.0.(Li
	0x00b0:  6e75 783b 2041 6e64 726f 6964 2036 2e30  nux;.Android.6.0
	0x00c0:  3b20 3135 3035 2d41 3031 2042 7569 6c64  ;.1505-A01.Build
	0x00d0:  2f4d 5241 3538 4b3b 2077 7629 2041 7070  /MRA58K;.wv).App
	0x00e0:  6c65 5765 624b 6974 2f35 3337 2e33 3620  leWebKit/537.36.
	0x00f0:  284b 4854 4d4c 2c20 6c69 6b65 2047 6563  (KHTML,.like.Gec
	0x0100:  6b6f 2920 5665 7273 696f 6e2f 342e 3020  ko).Version/4.0.
	0x0110:  4368 726f 6d65 2f36 322e 302e 3332 3032  Chrome/62.0.3202
	0x0120:  2e39 3720 4d6f 6269 6c65 2053 6166 6172  .97.Mobile.Safar
	0x0130:  692f 3533 372e 3336 0d0a 4163 6365 7074  i/537.36..Accept
	0x0140:  3a20 696d 6167 652f 7765 6270 2c69 6d61  :.image/webp,ima
	0x0150:  6765 2f61 706e 672c 696d 6167 652f 2a2c  ge/apng,image/*,
	0x0160:  2a2f 2a3b 713d 302e 380d 0a52 6566 6572  */*;q=0.8..Refer
	0x0170:  6572 3a20 6874 7470 3a2f 2f69 7076 362e  er:.http://ipv6.
	0x0180:  6179 6f75 6c65 7961 6e67 2e63 6e2f 3f74  ayouleyang.cn/?t
	0x0190:  3d34 0d0a 4163 6365 7074 2d45 6e63 6f64  =4..Accept-Encod
	0x01a0:  696e 673a 2067 7a69 702c 2064 6566 6c61  ing:.gzip,.defla
	0x01b0:  7465 0d0a 4163 6365 7074 2d4c 616e 6775  te..Accept-Langu
	0x01c0:  6167 653a 207a 682d 434e 2c65 6e2d 5553  age:.zh-CN,en-US
	0x01d0:  3b71 3d30 2e39 0d0a 436f 6f6b 6965 3a20  ;q=0.9..Cookie:.
	0x01e0:  5f67 613d 4741 312e 322e 3134 3233 3932  _ga=GA1.2.142392
	0x01f0:  3239 312e 3135 3630 3335 3331 3733 0d0a  291.1560353173..
	0x0200:  0d0a                                     ..
18:33:05.634840 IP6 (hlim 64, next-header TCP (6) payload length: 527) 240c:4082:0:1e03::5.http &amp;gt; 2409:896a:430:773c:2:1:a23d:5414.41535: Flags [P.], cksum 0xa3e0 (incorrect -&amp;gt; 0xb5c5), seq 610:1105, ack 913, win 240, options [nop,nop,TS val 6094348 ecr 15594926], length 495: HTTP, length: 495
	HTTP/1.1 404 Not Found
	Server: nginx/1.12.2
	Date: Sat, 06 Jul 2019 10:33:05 GMT
	Content-Type: text/html
	Content-Length: 318
	Connection: keep-alive
	ETag: &quot;5d2076a3-13e&quot;

	&amp;lt;head&amp;gt;
	&amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;
	&amp;lt;title&amp;gt;404&amp;lt;/title&amp;gt;
	&amp;lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&amp;gt;
	&amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&amp;gt;
	&amp;lt;/head&amp;gt;
	&amp;lt;body&amp;gt;
	0x0000:  6000 0000 020f 0640 240c 4082 0000 1e03  `......@$.@.....
	0x0010:  0000 0000 0000 0005 2409 896a 0430 773c  ........$..j.0w&amp;lt;
	0x0020:  0002 0001 a23d 5414 0050 a23f 17c1 4cf4  .....=T..P.?..L.
	0x0030:  5741 db92 8018 00f0 a3e0 0000 0101 080a  WA..............
	0x0040:  005c fe0c 00ed f5ae 4854 5450 2f31 2e31  .\......HTTP/1.1
	0x0050:  2034 3034 204e 6f74 2046 6f75 6e64 0d0a  .404.Not.Found..
	0x0060:  5365 7276 6572 3a20 6e67 696e 782f 312e  Server:.nginx/1.
	0x0070:  3132 2e32 0d0a 4461 7465 3a20 5361 742c  12.2..Date:.Sat,
	0x0080:  2030 3620 4a75 6c20 3230 3139 2031 303a  .06.Jul.2019.10:
	0x0090:  3333 3a30 3520 474d 540d 0a43 6f6e 7465  33:05.GMT..Conte
	0x00a0:  6e74 2d54 7970 653a 2074 6578 742f 6874  nt-Type:.text/ht
	0x00b0:  6d6c 0d0a 436f 6e74 656e 742d 4c65 6e67  ml..Content-Leng
	0x00c0:  7468 3a20 3331 380d 0a43 6f6e 6e65 6374  th:.318..Connect
	0x00d0:  696f 6e3a 206b 6565 702d 616c 6976 650d  ion:.keep-alive.
	0x00e0:  0a45 5461 673a 2022 3564 3230 3736 6133  .ETag:.&quot;5d2076a3
	0x00f0:  2d31 3365 220d 0a0d 0a3c 6865 6164 3e0a  -13e&quot;....&amp;lt;head&amp;gt;.
	0x0100:  3c6d 6574 6120 6368 6172 7365 743d 2275  &amp;lt;meta.charset=&quot;u
	0x0110:  7466 2d38 223e 0a3c 7469 746c 653e 3430  tf-8&quot;&amp;gt;.&amp;lt;title&amp;gt;40
	0x0120:  343c 2f74 6974 6c65 3e0a 3c6d 6574 6120  4&amp;lt;/title&amp;gt;.&amp;lt;meta.
	0x0130:  6874 7470 2d65 7175 6976 3d22 582d 5541  http-equiv=&quot;X-UA
	0x0140:  2d43 6f6d 7061 7469 626c 6522 2063 6f6e  -Compatible&quot;.con
	0x0150:  7465 6e74 3d22 4945 3d65 6467 6522 3e0a  tent=&quot;IE=edge&quot;&amp;gt;.
	0x0160:  3c6d 6574 6120 6e61 6d65 3d22 7669 6577  &amp;lt;meta.name=&quot;view
	0x0170:  706f 7274 2220 636f 6e74 656e 743d 2277  port&quot;.content=&quot;w
	0x0180:  6964 7468 3d64 6576 6963 652d 7769 6474  idth=device-widt
	0x0190:  682c 2069 6e69 7469 616c 2d73 6361 6c65  h,.initial-scale
	0x01a0:  3d31 223e 0a3c 2f68 6561 643e 0a3c 626f  =1&quot;&amp;gt;.&amp;lt;/head&amp;gt;.&amp;lt;bo
	0x01b0:  6479 3e0a 3c70 2061 6c69 676e 3d22 6365  dy&amp;gt;.&amp;lt;p.align=&quot;ce
	0x01c0:  6e74 6572 2220 7374 796c 653d 2266 6f6e  nter&quot;.style=&quot;fon
	0x01d0:  742d 7369 7a65 3a32 3870 783b 2066 6f6e  t-size:28px;.fon
	0x01e0:  742d 7765 6967 6874 3a62 6f6c 643b 6d61  t-weight:bold;ma
	0x01f0:  7267 696e 2d74 6f70 3a35 3070 783b 223e  rgin-top:50px;&quot;&amp;gt;
	0x0200:  3430 342d e682 a8e8 aebf e997 aee7 9a84  404-............
	0x0210:  e8b5 84e6 ba90 e4b8 8de5 ad98 e59c a8e3  ................
	0x0220:  8082 3c2f 703e 0a3c 2f62 6f64 793e 0a3c  ..&amp;lt;/p&amp;gt;.&amp;lt;/body&amp;gt;.&amp;lt;
	0x0230:  2f68 746d 6c3e 0a                        /html&amp;gt;.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;第七段包&quot;&gt;第七段包：&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;18:33:05.709495 IP6 (hlim 236, next-header TCP (6) payload length: 32) 2409:896a:430:773c:2:1:a23d:5414.41535 &amp;gt; 240c:4082:0:1e03::5.http: Flags [.], cksum 0x9e9e (correct), seq 913, ack 1105, win 1342, options [nop,nop,TS val 15594935 ecr 6094348], length 0
	0x0000:  6000 0000 0020 06ec 2409 896a 0430 773c  `.......$..j.0w&amp;lt;
	0x0010:  0002 0001 a23d 5414 240c 4082 0000 1e03  .....=T.$.@.....
	0x0020:  0000 0000 0000 0005 a23f 0050 5741 db92  .........?.PWA..
	0x0030:  17c1 4ee3 8010 053e 9e9e 0000 0101 080a  ..N....&amp;gt;........
	0x0040:  00ed f5b7 005c fe0c                      .....\..
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;第八段包啊呀忘了抓http四次挥手包了下次补上&quot;&gt;第八段包：（啊呀！忘了抓HTTP四次挥手包了，下次补上）&lt;/h3&gt;

&lt;h2 id=&quot;三ipv6的dns请求包-基于wireshark-2020-11记录&quot;&gt;（三）IPv6的DNS请求包-基于Wireshark 2020-11记录&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;在IPv6环境下请求解析www.cctv.com的UDP包&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;0000   94 0b 19 0d 09 e6 6c 4b 90 8a 88 02 86 dd 60 02   ......lK......`.
0010   36 b3 00 26 11 40 fe 80 00 00 00 00 00 00 a4 14   6..&amp;amp;.@..........
0020   1e b5 93 1b 4c d2 fe 80 00 00 00 00 00 00 00 00   ....L...........
0030   00 00 00 00 00 01 df 21 00 35 00 26 9f f1 80 68   .......!.5.&amp;amp;...h
0040   01 00 00 01 00 00 00 00 00 00 03 77 77 77 04 63   ...........www.c
0050   63 74 76 03 63 6f 6d 00 00 01 00 01               ctv.com.....
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;以太网&quot;&gt;以太网&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;94 0b 19 0d 09 e6 6c 4b 90 8a 88 02 86 dd&lt;/code&gt; 以太网&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;94 0b 19 0d 09 e6&lt;/code&gt; 源MAC地址&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;6c 4b 90 8a 88 02&lt;/code&gt; 目的MAC地址&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;86 dd&lt;/code&gt; 是IPv6协议&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/wireshark-dns-01.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;ipv6协议共40字节&quot;&gt;IPv6协议，共40字节&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;60 02 36 b3 00 26 11 40&lt;/code&gt; 协议内容
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;00 26&lt;/code&gt; 长度38&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;11&lt;/code&gt;为下一头部：17 UDP协议（请看页脚的协议类型）&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;40&lt;/code&gt;为 hop limit&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fe 80 00 00 00 00 00 00 a4 14 1e b5 93 1b 4c d2&lt;/code&gt; 源IP&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fe 80 00 00 00 00 00 00 00 00 00 00 00 00 00 01&lt;/code&gt; 目的IP&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/wireshark-dns-02.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;udp协议共8字节&quot;&gt;UDP协议，共8字节&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;df 21&lt;/code&gt; 源端口&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;00 35&lt;/code&gt; 目的端口&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;00 26 9f f1&lt;/code&gt; 16位UDP长度，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;26&lt;/code&gt;即38字节，数据部分则30字节；16位UDP校验和&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;UDP一次最多能传输的数据大小：2^16 - 1 - 8 = 65507字节（-8是因为udp头部本身占用8个字节）&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/wireshark-dns-03.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;dns请求解析的内容&quot;&gt;DNS请求解析的内容&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;80 68 01 00 00 01 00 00 00 00 00 00 03&lt;/code&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0001&lt;/code&gt;为A记录&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;77 77 77 04 63 63 74 76 03 63 6f 6d&lt;/code&gt; www.cctv.com&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;00 00 01 00 01&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/wireshark-dns-04.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;四ipv6的icmp&quot;&gt;（四）IPv6的ICMP&lt;/h2&gt;

&lt;h5 id=&quot;执行请求&quot;&gt;执行请求&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;C:\Users\linzening&amp;gt;ping ayouleyang.cn -n 1

正在 Ping ayouleyang.cn [2408:4003:1101:7400::6] 具有 32 字节的数据:
来自 2408:4003:1101:7400::6 的回复: 时间=64ms

2408:4003:1101:7400::6 的 Ping 统计信息:
    数据包: 已发送 = 1，已接收 = 1，丢失 = 0 (0% 丢失)，
往返行程的估计时间(以毫秒为单位):
    最短 = 64ms，最长 = 64ms，平均 = 64ms
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;icmpv6请求报文&quot;&gt;ICMPv6请求报文：&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;0000   1c 78 4e 8f c7 e0 1c 4d 70 b9 84 ee 86 dd 60 00   .xN.Çà.Mp¹.î.Ý`.
0010   00 00 00 28 3a 40 24 09 8a 6a 02 27 0d c0 85 4b   ...(:@$..j.&apos;.À.K
0020   ef d5 0a 5e af e8 24 08 40 03 11 01 74 00 00 00   ïÕ.^¯è$.@...t...
0030   00 00 00 00 00 06 80 00 f9 91 00 01 04 91 61 62   ........ù.....ab
0040   63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72   cdefghijklmnopqr
0050   73 74 75 76 77 61 62 63 64 65 66 67 68 69         stuvwabcdefghi
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;icmpv6响应报文&quot;&gt;ICMPv6响应报文&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;0000   1c 4d 70 b9 84 ee 1c 78 4e 8f c7 e0 86 dd 60 40   .Mp¹.î.xN.Çà.Ý`@
0010   ae 29 00 28 3a 06 24 08 40 03 11 01 74 00 00 00   ®).(:.$.@...t...
0020   00 00 00 00 00 06 24 09 8a 6a 02 27 0d c0 85 4b   ......$..j.&apos;.À.K
0030   ef d5 0a 5e af e8 81 00 f8 91 00 01 04 91 61 62   ïÕ.^¯è..ø.....ab
0040   63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72   cdefghijklmnopqr
0050   73 74 75 76 77 61 62 63 64 65 66 67 68 69         stuvwabcdefghi
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;请求包ipv6数据&quot;&gt;请求包IPv6数据&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;60 00 00 00 00 28 3a 40&lt;/code&gt; IPv6头部
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;00 28&lt;/code&gt; 长度40字节&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3a&lt;/code&gt; 协议类型 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;58&lt;/code&gt; 即 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ICMP for IPv6&lt;/code&gt;（请看页脚的协议类型）&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;40&lt;/code&gt; 跳数限制 64&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/wireshark-icmp-01.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;icmp数据&quot;&gt;ICMP数据&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;80 00 f9 91 00 01 04 91&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 61 62 63 64 65 66 67 68 69&lt;/code&gt; ICMP内容 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;abcdefghijklmnopqrstuvwabcdefghi&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/wireshark-icmp-02.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;响应包ip内容&quot;&gt;响应包IP内容&lt;/h4&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/wireshark-icmp-03.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;响应包icmp内容&quot;&gt;响应包ICMP内容&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;81 00 f8 91 00 01 04 91&lt;/code&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;81&lt;/code&gt; Type，类型&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;00&lt;/code&gt; Code&lt;/li&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f8 91&lt;/code&gt; Checksum 校验和&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/wireshark-icmp-04.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;blockquote&gt;
  &lt;p&gt;总结：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;（1）整个请求步骤分为TCP三次握手、HTTP请求与响应（多个）、TCP四次挥手。&lt;/p&gt;

&lt;p&gt;（2）&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HTTP/1.1&lt;/code&gt; 使用一个连接可以传输多个文件，而&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HTTP/1.0&lt;/code&gt;不能，所以&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HTTP/1.0&lt;/code&gt;很快就被&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HTTP/1.1&lt;/code&gt;替代了。而HTTP2可以同一时间打开多个HTTP请求，而HTTP/1.1不能。&lt;/p&gt;

&lt;p&gt;（3）猜想：keep-alive让这个TCP保持连接，等待下次请求再次使用这个连接。&lt;/p&gt;

&lt;p&gt;（4）根据HTTP响应包，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;网站建设中&lt;/code&gt;对应的代码为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;e7 bd91 e7ab 99e5 bbba e8ae bee4 b8ad&lt;/code&gt;，该文字使用urlencode编码结果&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;%e7%bd%91%e7%ab%99%e5%bb%ba%e8%ae%be%e4%b8%ad&lt;/code&gt;相匹配，可了解中文是如何编码传输的。（我记得以前说的中文占两个字节，到这里占的是3个字节，可以了解下Unicode编码和UTF-8编码）&lt;/p&gt;

&lt;p&gt;（5）TCP的seq/ack/syn规则：&lt;/p&gt;

&lt;p&gt;（6）SYN攻击则为客户端发送第一个握手包，并不发送第三个握手包，耗尽服务器的TCP资源。&lt;/p&gt;

&lt;p&gt;（7）TCP（传输控制协议）作用&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;（1）面向连接的、可靠地、基于字节流的传输层通信协议&lt;/li&gt;
  &lt;li&gt;（2）将应用层的数据流分割成报文段并发送给目标节点的TCP层&lt;/li&gt;
  &lt;li&gt;（3）数据包都有序号，对方收到则发送ACK确认，未收到则重传&lt;/li&gt;
  &lt;li&gt;（4）使用校验和来检验数据在传输过程中是否有误&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;（8）UDP头部占8字节，源端口、目的端口、长度、校验和&lt;/p&gt;

&lt;p&gt;（9）ICMPv6是网络层协议&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;a href=&quot;http://tool.oschina.net/hexconvert/&quot;&gt;进制转换&lt;/a&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;blockquote&gt;
  &lt;p&gt;参考文章：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://mp.weixin.qq.com/s?__biz=MzIxMjAzMDA1MQ==&amp;amp;mid=2648945706&amp;amp;idx=1&amp;amp;sn=9e0c53430969a31058c47d4fa18adcd3&amp;amp;chksm=8f5b5326b82cda30461c4f1cd7a41898f5e819180e3edafeced9f4024f2e5d585f706ec566fb&amp;amp;mpshare=1&amp;amp;scene=23&amp;amp;srcid=0704kxjRiytXrFsW8uVWxVnZ#rd&quot;&gt;30分钟掌握tcpdump&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.cnblogs.com/feng9exe/p/8058891.html&quot;&gt;TCP报文格式详解&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.cnblogs.com/xzmxddx/p/10354724.html&quot;&gt;TCP报文段详解&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.51cto.com/lyhbwwk/2162568&quot;&gt;TCP/IP 数据包报文格式&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;注释&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:pn&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml&quot;&gt;IP报文协议编号&lt;/a&gt; &lt;a href=&quot;#fnref:pn&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>IPv6笔记</title>
   <link href="https://comeround.cn/article/ipv6-note.html"/>
   <updated>2019-06-27T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/ipv6-note</id>
   <content type="html">&lt;h2 id=&quot;〇ipv6介绍&quot;&gt;〇、IPv6介绍&lt;/h2&gt;

&lt;p&gt;IPv6的出现是为了从根本上解决IPv4地址耗尽的问题（IPv4地址早在2011年就正式耗尽了）。IPv4版本的IP地址只有4字节大小，即32位长度的IP地址。IPv6版本的IP地址有16字节大小，即128位的长度。&lt;/p&gt;

&lt;p&gt;（1）IPV6优点&lt;/p&gt;

&lt;p&gt;1、IPv4是美国的，IPv6是全球的（你懂的，不限于单方面控制）。&lt;/p&gt;

&lt;p&gt;1、全世界都在使用公网地址（无需NAT：保障端到端通信）。&lt;/p&gt;

&lt;p&gt;2、性能、效率（更简单的报文提高了路由器的效率，但目前IPv6的时延比较高）&lt;/p&gt;

&lt;p&gt;（2）IPv6地址&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;IPV6地址由128位组成，使用8个16位段来表示，每个16位段使用十六进制数字表示即每4个十六进制为一组，之间使用英文冒号’:’分开，格式为：x:x:x:x:x:x:x:x x代表4个十六进制位，举例：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2035:0001:2BC5:0000:0000:087C:0000:000A&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;简写规则：省略前导0、双冒号省略连续0&lt;/li&gt;
  &lt;li&gt;前缀：通过在IPV6地址后面加一个斜线/，再跟一个十进制的数字来标识一个IPV6地址的起始位由多少位是前缀位，一般前缀为56或64位，如：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3ffe:1994:100:a::/64&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;后缀长度为64位，根据MAC地址动态创建。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;（3）IPv6地址类型&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;IPv6地址&lt;/th&gt;
      &lt;th&gt;功能&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;0:0:0:0:0:0:0:0 =::&lt;/td&gt;
      &lt;td&gt;等价于IPv4的0.0.0.0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;0:0:0:0:0:0:0:1 =::1&lt;/td&gt;
      &lt;td&gt;等价于IPv4的127.0.0.1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;0:0:0:0:0:0:0:192.168.100.1&lt;/td&gt;
      &lt;td&gt;这是在IPv6/v4混合网络中IPv4地址表示&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2000::/3&lt;/td&gt;
      &lt;td&gt;全球单播地址范围，公网IPv6&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;FC00::/7&lt;/td&gt;
      &lt;td&gt;Unique-local地址，本地唯一单播地址范围，fd00::/8常用，可做局域网地址&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;FE80::/10&lt;/td&gt;
      &lt;td&gt;Link-local链路本地单播地址范围，类似于169.254.0.0/16&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;FEC0::/10&lt;/td&gt;
      &lt;td&gt;Site-local地址【已弃用】&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;FF00::/8&lt;/td&gt;
      &lt;td&gt;组播地址范围&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;3FFF:FFFF::/32&lt;/td&gt;
      &lt;td&gt;为示例和文档保留的地址&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2001::/32&lt;/td&gt;
      &lt;td&gt;Teredo隧道地址，IPv6前期使用&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2001:0DB8::/32&lt;/td&gt;
      &lt;td&gt;也是为示例和文档保留的地址&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2002::/16&lt;/td&gt;
      &lt;td&gt;拥有IPv6到IPv4的转换系统，IPv6包直接通过IPv4网络传输【已弃用】&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;其他资料：&lt;a href=&quot;https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml&quot;&gt;IPv6特殊注册地址&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2021/nat64.gif&quot; alt=&quot;IPv6转换服务&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;一从报文说起&quot;&gt;一、从报文说起&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/ipv4and6.png&quot; alt=&quot;&quot; /&gt;
&lt;img src=&quot;/public/blog/2019/ipconnect.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Version（版本）：该字段表示IP版本，值为6。版本字段用来表示IP数据报使用的是IPv6协议封装，占4位，对应值为6（0110）。&lt;/li&gt;
  &lt;li&gt;Traffic class（流量类别/通信分类）：该字段及其功能类似于IPv4的业务类型字段。该字段以区分业务编码点（DSCP）标记一个IPv6数据包，以此指明数据包应当如何处理。通信分类字段用来标识对应IPv6的通信流类别，或者说是优先级别，占8位，类似于IPv4中的ToS（服务类型）字段。&lt;/li&gt;
  &lt;li&gt;Flow label（流标签）：该字段用来标记IP数据包的一个流，当前的标准中没有定义如何管理和处理流标签的细节。/流标签字段时IPv6数据报中新增的一个字段，占20位，可用来标记报文的数据流类型，以便在网络层区分不同的报文。流标签字段有源节点分配，通过流标签、源地址、目的地址三元组方式就可以唯一标识一条通信流，而不用像IPv4那样需要使用五元组方式（源地址、目的地址、源端口、目的端口和传输层协议号）。这样发动的最大好处有两点：一是流标签可以和任意的关联，需要标识不同类型的流（可以是非五元组）时，无需对流标签做改动；二是流标签在IPv6基本头中，使用IPSec时此域对转发路由器可见，因此转发路由器可以在使用IPv6报文IPSec的情况下仍然可以通过三元组（流标签、源地址、目的地址）针对特定的流进行QoS（质量服务）处理。&lt;/li&gt;
  &lt;li&gt;Payload length（有效载荷长度）：该字段表示有效载荷的长度，有效载荷是指紧跟IPv6基本报头的数据包，包含IPv6扩展报头。/有效载荷长度字段是以字节为单位的标识IPv6数据报中有效载荷部分（包括所有扩展报头部分）的总长度，也就是除了IPv6的基本报头以外的其他部分的总长度，占20位。&lt;/li&gt;
  &lt;li&gt;Next header（下一报头）：该字段指明了跟随在IPv6基本报头后的扩展报头的信息类型。/下一个头部字段用来标识当前报头（或者扩展报头）的下一个头部类型，占8位。每种扩展报头都有其对应的值。下一个头部字段内定义的扩展报头类型与IPv4中的协议字段值类似，但在IPv6数据报中，紧接着IPv6报头的可能不是上层协议头部（当没有扩展报头或者为最后一个扩展报头时才是上层协议头），而是IPv6扩展报头。这一机制下处理扩展报头更搞笑，因为标识了数据报中对应的上层协议或者扩展报头类型，转发路由器只需处理必须处理的扩展报头，提高了转发效率。&lt;/li&gt;
  &lt;li&gt;Hop Limit（跳数限制）：跳数限制于IPv4报文中的TTL字段类似，指定了报文可以有效转发的次数，占8位。报文每经过一个路由器结点，跳数值就减1，当此字段值减到0时，则直接丢弃该报文。&lt;/li&gt;
  &lt;li&gt;源地址（Source IP Address）：源IP地址字段标识了发送该IPv6报文源节点的IPv6地址，占128位。&lt;/li&gt;
  &lt;li&gt;目的IP地址（Destination IP Address）：目的IP地址字段标识了IPv6报文的接受节点的IPv6地址，占128位。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;IP报头部分固定为40字节长度（64[4+8+20+20+8]+128+128）bit，有效载荷部分最长不得超过65535字节（64KB）。&lt;/p&gt;

&lt;h2 id=&quot;二地址段分配和国内常用地址段&quot;&gt;二、地址段分配和国内常用地址段&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;IPv6雪人计划全球根DNS分布情况 &lt;a href=&quot;https://yeti-dns.org/operators.html&quot; target=&quot;\_blank&quot;&gt;雪人DNS项目&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;国内地址查询：&lt;a href=&quot;http://hello.fe80.cn/pages/ipv6/query.html&quot; target=&quot;\_blank&quot;&gt;ipv6国内地址查询&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;（1）国内DNS(部分)&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;下一代互联网中心(天地互联)：240c::6666、240c::6644&lt;/li&gt;
  &lt;li&gt;中国联通公共DNS：2408:8899::8、2408:8888::8&lt;/li&gt;
  &lt;li&gt;中国电信：240e:1f:1::1、240e:1f:1::33、240e:4c:4008::1、240e:4c:4808::1、240e:46:4888::4888&lt;/li&gt;
  &lt;li&gt;中国移动：2409:805e:2000::8888、2409:805e:2000::6666、2409:8030:2000::1&lt;/li&gt;
  &lt;li&gt;百度：2400:da00::6666&lt;/li&gt;
  &lt;li&gt;教育网：2001:da8::666(清华大学)&lt;/li&gt;
  &lt;li&gt;阿里云：2400:3200::1、2400:3200:baba::1&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;（2）国内运营商主要公众网段&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;电信：240e::/18&lt;/li&gt;
  &lt;li&gt;移动：2409:8000::/20&lt;/li&gt;
  &lt;li&gt;联通：2408:8000::/20&lt;/li&gt;
  &lt;li&gt;广电：240a:4000::/21（暂未检测到IP）&lt;/li&gt;
  &lt;li&gt;教育网：2001:da8::/32、2001:250::/32、240c:c000::/20&lt;/li&gt;
  &lt;li&gt;百度：2400:da00::/32、240c:4000::/22&lt;/li&gt;
  &lt;li&gt;阿里巴巴：2408:4000::/22、240b:4000::/22【境外】&lt;/li&gt;
  &lt;li&gt;腾讯：2402:4e00::/32、240f:4000::/24&lt;/li&gt;
  &lt;li&gt;天地互连：240c::/28&lt;/li&gt;
  &lt;li&gt;华为：2407:c080::/32&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;三ipv6相关网络工具及dns解析&quot;&gt;三、IPv6相关网络工具及DNS解析&lt;/h2&gt;

&lt;p&gt;（1）dig&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dig ipv6.baidu.com AAAA @240c::6666
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（2）curl&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl -6 http://ipv6.baidu.com/ -v
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;如果报错：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl: (3) [globbing] error: bad range specification after pos 9&lt;/code&gt;，需要加&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-g&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;（3）ping/ping6&lt;/p&gt;

&lt;p&gt;1.Windows/Linux&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ping -6 ipv6.baidu.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;2.Linux&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ping6 ipv6.baidu.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;（4）telnet&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;telnet 240e:a8::6789 80
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（4）tcping&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;tcping 240e:a8::6789 80
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（5）mtr&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mtr 240e:a8::6789
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（6）traceroute6&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;traceroute6 240e:a8::6789
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（7）ip&amp;amp;route&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ip -6 route 240e:a8::6789
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;（8）wget&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wget -6 http://upyun.vpser.net/lnmp/lnmp1.6-full.tar.gz
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;（9）ssh&lt;/p&gt;

&lt;p&gt;配置文件 /etc/ssh/sshd_config 中，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AddressFamily inet&lt;/code&gt;改为&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AddressFamily any&lt;/code&gt;，兼容IPv4和IPv6使用ssh连接。[别忘了重启]&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ssh root@240e:a8::6789
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;（10）浏览器访问&lt;/p&gt;

&lt;p&gt;浏览器地址栏输入的IP应该是：&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;http://[240e:a8::6789]:8080/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;因IPv6和IPv4格式不同，为避免有些浏览器不支持IP访问，建议不要配置直接使用IPv6地址访问，应使用域名访问。&lt;/p&gt;

&lt;p&gt;（11）查询某个公共DNS使用的根服务器有哪些&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dig . NS @240c::6666

;; ANSWER SECTION:
.                       83277   IN      NS      ns1-6ors.dns-lab.net.
.                       83277   IN      NS      ns2-6ors.dns-lab.net.
.                       83277   IN      NS      ns3-6ors.dns-lab.net.
.                       83277   IN      NS      ns4-6ors.dns-lab.net.
.                       83277   IN      NS      ns5-6ors.dns-lab.net.
.                       83277   IN      NS      ns-6ors.ix.ru.
.                       83277   IN      NS      ns-6ors.dns-lab.net.
.                       83277   IN      NS      ns-6ors.cattelecom.com.
.                       83277   IN      NS      ns-6ors.philv6forum.org.
.                       83277   IN      NS      ns-6ors.ipv6forummalaysia.com.
.                       83277   IN      NS      ns0-6ors.dns-lab.net.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;结论：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;240c::6666&lt;/code&gt;使用的根DNS有以上11个。&lt;/p&gt;

&lt;p&gt;DNS解析规则：&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;同一个域名可同时解析多个A记录和AAAA记录，但不能同时解析CNAME记录&lt;/li&gt;
  &lt;li&gt;CNAME记录可以连续解析（A-&amp;gt;B-&amp;gt;C-D）,A域名可以CNAME到B域名，B域名可以CNAME到C域名，直到有A/AAAA记录。&lt;/li&gt;
  &lt;li&gt;若CNAME解析记录中的域名同时解析A记录和AAAA记录，等同于该域名同时解析A记录和AAAA记录&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;四配置ipv6&quot;&gt;四、配置IPv6&lt;/h2&gt;

&lt;p&gt;（1）CentOS配置ipv6&lt;/p&gt;

&lt;p&gt;编辑 /etc/sysctl.conf&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;查看配置结果 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sysctl -p&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@baidu-bcc ~]# ifconfig
eth0: &lt;span class=&quot;nv&quot;&gt;flags&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt;  mtu 1500
        inet 172.16.0.8  netmask 255.255.240.0  broadcast 172.16.15.255
        inet6 240c:4082:0:1311::4  prefixlen 128  scopeid 0x0&amp;lt;global&amp;gt;
        inet6 fe80::f816:3eff:fe27:31c2  prefixlen 64  scopeid 0x20&amp;lt;&lt;span class=&quot;nb&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;（2）Windows配置IPv6（需要运营商提供IPv6）&lt;/p&gt;

&lt;p&gt;命令行执行：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ipconfig/all&lt;/code&gt; 查看IP&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;C:\Users\lite&amp;gt;ipconfig/all

Windows IP 配置

   主机名  . . . . . . . . . . . . . : Little-work
   主 DNS 后缀 . . . . . . . . . . . :
   节点类型  . . . . . . . . . . . . : 混合
   IP 路由已启用 . . . . . . . . . . : 否
   WINS 代理已启用 . . . . . . . . . : 否

以太网适配器 以太网:

   连接特定的 DNS 后缀 . . . . . . . :
   描述. . . . . . . . . . . . . . . : Realtek PCIe GBE Family Controller
   物理地址. . . . . . . . . . . . . : F4-4D-30-58-44-5B
   DHCP 已启用 . . . . . . . . . . . : 否
   自动配置已启用. . . . . . . . . . : 是
   IPv4 地址 . . . . . . . . . . . . : 192.168.1.58(首选)
   IPv6 地址. . . . . . . . . . . . . : 240c:4082:0:1311::4(首选)
   子网掩码  . . . . . . . . . . . . : 255.255.255.0
   默认网关. . . . . . . . . . . . . : 192.168.1.2
   DNS 服务器  . . . . . . . . . . . : 114.114.114.114
                                       223.5.5.5
   TCPIP 上的 NetBIOS  . . . . . . . : 已启用
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（3）Windows连接手机热点连接IPv6&lt;/p&gt;

&lt;p&gt;如果你所在运营商没有提供IPv6，但手机流量有IPv6，可由手机打开热点提供给Windows IPv6。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/ipv6-4g-windows.png&quot; alt=&quot;&quot; width=&quot;400px&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;blockquote&gt;
  &lt;p&gt;常用IPv6测试工具&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://bgp.he.net/&quot;&gt;ISP检测&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://test-ipv6.com/index.html.zh_CN&quot;&gt;IPv6地址检测&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://ip.sb&quot;&gt;IP.SB&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.china-ipv6.cn/&quot;&gt;国家IPv6发展监测平台(新)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://ipv6c.cngi.edu.cn/&quot;&gt;教育系统IPv6发展态势监测平台&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest&quot;&gt;apnic最新分配记录&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://stats.labs.apnic.net/ipv6/&quot;&gt;IPv6国际可用率&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://iptv.pdsu.edu.cn&quot;&gt;IPTV平顶山学院【作废】&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.v6top.com/&quot;&gt;全国政府网站IPv6支持度监测平台【作废】&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.chinaipv6.org/&quot;&gt;IPv6监测平台【作废】&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://v6view.cngi.cn/ipv6test/&quot;&gt;国家IPv6发展监测平台【作废】&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;blockquote&gt;
  &lt;p&gt;参考文献&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://blog.itpub.net/31559359/viewspace-2637668/&quot;&gt;IPv6入门教程&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blog.csdn.net/u011784495/article/details/71693296&quot;&gt;IPv6数据报头部格式&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.jb51.net/network/400251.html&quot;&gt;IPV6网络协议基础知识 IPV6地址和IPV6报文格式详细介绍&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.toutiao.com/a7013183742294393351/&quot;&gt;图解IPv6&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>使用Workerman做一个聊天室</title>
   <link href="https://comeround.cn/article/workerman-make-a-chat.html"/>
   <updated>2019-06-20T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/workerman-make-a-chat</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;为什么要写这篇文章？&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;        我学习 Workerman 好几次了，每次都失败（没做成想要的功能，原谅我比较笨）。但是这次也花了好几个小时，把之前没做成的功能实现了。其实就是两个简单的功能：一对一发送消息，广播消息（群聊）。这个功能用swoole早都实现了，也是由于之前一直想用 think-worker 的原因，想想还是得自己琢磨才行，人家做好的框架或许是个阉割版。&lt;/p&gt;

&lt;p&gt;别问我为什么不用swoole，因为 Workerman 可以在Windows中运行。&lt;/p&gt;

&lt;h2 id=&quot;1首先得简单说说-thinkphpworkerman-的安装&quot;&gt;（1）首先，得简单说说 thinkphp+workerman 的安装。&lt;/h2&gt;

&lt;p&gt;安装 thinkphp5.1&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;composer create-project topthink/think=5.1.x-dev tp5andWorkerman
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;安装 think-worker&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;composer require topthink/think-worker=2.0.*
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;直接安装 Workerman&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;composer require workerman/workerman
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;2我们先看-think-worker-的代码&quot;&gt;（2）我们先看 think-worker 的代码&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;config/worker_server.php&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;先来个服务器广播消息的示例，每10秒钟定时广播一条消息&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;s1&quot;&gt;&apos;onWorkerStart&apos;&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;\Workerman\Lib\Timer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// 遍历当前进程所有的客户端连接，发送自定义消息&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;connections&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;name&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;系统信息&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;content&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;这是一个定时任务信息&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;time&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;json_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;但是在 onMessage 时，我们获取不到 $worker 对象，所以无法广播消息。&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;s1&quot;&gt;&apos;onMessage&apos;&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$origin&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;name&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;广播数据&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;content&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$origin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;content&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;connections&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;尝试了各种方法，貌似都不行&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;s1&quot;&gt;&apos;onMessage&apos;&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 这样是获取不到 $worker 对象的&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// ...省略代码&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;所以只能抛弃 thinkphp 给我们封装的 think-worker 框架，得自己写，（或者修改框架内部代码）&lt;/p&gt;

&lt;p&gt;修改框架内部的代码：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/vendor/topthink/think-worker/src/command/Server.php&lt;/code&gt;，主要是把 onMessage 方法自己加进去&lt;/p&gt;

&lt;p&gt;use() 就是把外部变量传递到函数内部使用，或者使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;global $worker&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$socket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;onMessage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$origin&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;name&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;广播数据&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;content&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$origin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;content&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;uid&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;connections&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样，我们就能够获取到 $worker 对象了&lt;/p&gt;
&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;onMessage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;...&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;3connection-绑定-uid&quot;&gt;（3）$connection 绑定 uid&lt;/h2&gt;

&lt;p&gt;其实你早都已经看出，$worker-&amp;gt;connections 获取到的是当前所有用户的连接，connections 即为其中一个链接。&lt;/p&gt;

&lt;p&gt;记录websocket连接时间：&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;onConnect&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;login_time&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;获取websocket连接时间：&lt;/p&gt;
&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;onMessage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$login_time&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;login_time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;由此可以看出，我们可以把数据绑定到 $connection 连接的一个属性，例如：&lt;/p&gt;
&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uid&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$uid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;当JavaScript端在连接websocket服务器成功后，即把自己的 uid 立马发送服务端绑定：&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;uid&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;600&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;ws&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onopen&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ws&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;yes&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;uid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}));&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;onMessage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$origin&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;array_key_exists&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;bind&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$origin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)){&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uid&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$origin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;uid&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;4单播发送消息即自定义发送&quot;&gt;（4）单播发送消息，即自定义发送&lt;/h2&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;onMessage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$origin&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$sendTo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$origin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;sendto&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 需要发送的对方的uid&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$origin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;content&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 需要发送到对方的内容&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;connections&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uid&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$sendTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;到此，已经完成基于 Workerman 的自定义对象发送消息。&lt;/p&gt;

&lt;p&gt;由于该php文件存放于composer中，只需要把该文件复制出来，放到&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;application/command&lt;/code&gt;，修改命名空间，即可保存到自己的项目中&lt;/p&gt;

&lt;h2 id=&quot;5存储聊天记录&quot;&gt;（5）存储聊天记录&lt;/h2&gt;

&lt;p&gt;使用 Redis 做缓存对服务器影响较小，且基本不影响响应时间&lt;/p&gt;

&lt;p&gt;1、把聊天记录存储到 Redis 中，使用列表存储&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// $data为接收到的数据&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$redis_instance&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Cache&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;handler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// TP5代码获取Cache实例&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$redis_instance&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lPush&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;message&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;json_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;JSON_UNESCAPED_UNICODE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;2、某些情况下，当用户第一次（或刷新）聊天页面时，显示最近10条记录&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$redis_instance&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Cache&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;handler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// TP5代码获取Cache实例&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$worker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;onConnect&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$redis_instance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$length&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$redis_instance&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lLen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;message&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$length&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;recently&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;array_reverse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$redis_instance&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lRange&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;message&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;state&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;JSON_UNESCAPED_UNICODE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;state&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;204&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;recently&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[];&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;msg&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;暂无聊天记录&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;JSON_UNESCAPED_UNICODE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;$connection&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;javascript获取到 recently 最近聊天记录时处理：&lt;/p&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;ws&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onmessage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;your&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;your&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;recently&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// 初次打开页面，渲染最近10条聊天记录&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;each&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;your&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;recently&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;// TODO:遍历渲染页面&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;// 处理其他消息&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;msglist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;li&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;your&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;6对比swoole&quot;&gt;（6）对比swoole&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;1、Workerman可以在windows系统中运行，swoole则不能。&lt;/li&gt;
  &lt;li&gt;2、Workerman：$worker-&amp;gt;connections获取所有连接，$connection-&amp;gt;id获取自己的连接id；swoole：$server-&amp;gt;connections获取所有连接，$connection-&amp;gt;fd获取自己的连接id。&lt;/li&gt;
  &lt;li&gt;3、Workerman启动时执行 onWorkerStart 方法，可以把定时器写入到里面；swoole 使用 WorkerStart 启动定时器。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;仅仅于聊天室或者定时器而言，Workerman 还是比较方便的。&lt;/p&gt;

&lt;h2 id=&quot;7项目扩展&quot;&gt;（7）项目扩展&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;对该系统新增禁言功能；&lt;/li&gt;
  &lt;li&gt;添加用户头像显示；&lt;/li&gt;
  &lt;li&gt;增加图片发送和显示；&lt;/li&gt;
  &lt;li&gt;表情显示；&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;8关于websocket协议&quot;&gt;（8）关于Websocket协议&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;WebSocket和HTTP是不同应用协议&lt;/li&gt;
  &lt;li&gt;WebSocket设计为通过80和443端口工作，以及支持HTTP代理和中介&lt;/li&gt;
  &lt;li&gt;WebSocket握手时使用HTTP Upgrade头从HTTP协议更改为WebSocket协议&lt;/li&gt;
&lt;/ul&gt;

&lt;h6 id=&quot;最终实现效果如下&quot;&gt;最终实现效果如下：&lt;/h6&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/chat-html.png&quot; alt=&quot;&quot; height=&quot;500px;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/workerman.html.pc.jpg&quot; alt=&quot;&quot; height=&quot;500px;&quot; /&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>启蒙酸菜制作技艺</title>
   <link href="https://comeround.cn/article/qimeng.html"/>
   <updated>2019-06-20T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/qimeng</id>
   <content type="html">&lt;style&gt;
    .post&gt;p{text-indent:2em;}
    .post&gt;p&gt;img{height:300px;margin:10px auto;}
&lt;/style&gt;

&lt;h3 id=&quot;启蒙酸菜制作技艺&quot;&gt;启蒙酸菜制作技艺&lt;/h3&gt;

&lt;p&gt;颇具盛名的贵州锦屏启蒙酸菜造型独特、色泽亮丽、香气高雅、质地脆嫩、味道纯正鲜美，在黔东南自治州己家喻户晓、人人皆知，2008年荣获“黔东南13大名菜”称号，该酸菜是餐桌上的上品，可生食、炒制或打汤，风靡半个中国的凯里苗家酸汤鱼在2010年上海世界博览会作为贵州唯一地方特色饮食出展，启蒙酸菜就是它的风味提升重要配料，贵州生态农业产品一启蒙酸菜深受广大消费者喜爱。本酸菜的腌制方法传统独特、工艺精湛考究。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/qimeng001.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;启蒙酸菜优良的品质在黔东南自治州内享有盛名、经久不衰，赋予它“黔东南特产”的美称。启蒙酸菜是贵州及周边省区消费者餐桌上的上品，深受宠爱，国内颇具影响力的苗族生态菜肴凯里酸汤鱼启蒙酸菜确是必不可少的配料，它对酸汤火锅风味提升起到根本性的作用。&lt;/p&gt;

&lt;p&gt;盛产于启蒙的芥菜产量高、质量优，用新鲜芥菜腌制酸菜是当地的传统，其酸菜制作工艺考究、技术精湛、质量优良，侗族群众饮食习惯决定了启蒙酸菜悠久的生产历史，一到芥菜收割季节启蒙镇家家户户频频腌制酸菜，独特的酸菜腌制方法和精湛传统的工艺技术人人都能熟练掌握，在历史长河中从不流失。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/qimeng002.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;启蒙酸菜是采用本地芥菜晾晒柔软后按单独一棵折叠捆绑腌制而成的，以腌制1.5–3个月风味最佳，开坛开缸不及时使用容易过度酸化和变劣品质，缘于这个弱点便给启蒙酸菜初级产品长时间、远距离销售带来极大的困难。&lt;/p&gt;

&lt;p&gt;优质的芥菜原料加上传统精湛的腌制技术赋予了启蒙酸菜独特的风味品质，2008年启蒙酸菜以色泽金黄、质地脆嫩、造型美观、风味纯正等综合优良品质被评为“黔东南13大名菜”。启蒙酸菜是消费者餐桌上的美味佳肴，其使用上适合单独打汤、配粥面食、炖制排骨猪脚、调制苗家酸汤鱼等，2010年上海世界博览会上苗家酸汤鱼作为贵州唯一饮食出展，名气大振。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/qimeng003.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;启蒙的气候和土壤条件很适合芥菜种植生长，地方芥菜品种的种性特点在这里可得以充分体现，据了解，作腌制启蒙酸菜原料使用的芥菜为当地地方品种，繁殖方式上均为自我留种，启蒙地方芥菜有两种类型即叶片缺刻型和叶片全缘型。&lt;/p&gt;

&lt;p&gt;芥菜洗涤必须认真细致，要彻底清洗去附着在菜叶及茎杆上的泥土、虫卵和其它赃物，只有经彻底干净洗涤过的芥菜方能有效减少杂菌混入腌制过程中，以确保正常的乳酸发酵和酸菜产品纯正的风格风味。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/qimeng004.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;腌制时采用土坛极易造成过度发酵而深度酸化使酸菜产品酸味过重；塑料桶属于化工产品不耐高盐和高酸，受塑化剂影响，酸菜产品的质量安全性难以保障；木桶是用当地杉木资源为材料加工而成的，它既耐盐又耐酸、卫生安全、能效解决腌制过程中菜的深度酸化问题还便于自由搬动，是启蒙酸菜腌制的最佳工具。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/qimeng005.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;启蒙酸菜腌制属于传统民族性的非物质文化加工技术，从民族文化保护的角度出发一定要继承和发展。建议自治州人民政府要高度重视，尽快开展启蒙酸菜制作传承人评选使精湛的民族技术文化世代相传，防止酸菜腌制技术从我们身边流失和走样。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/suan01.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;苗家酸汤鱼是我州最著名的菜肴，启蒙酸菜是苗家酸汤鱼提升风格的“味精菜”，在全州范围内启蒙酸菜若能与贵州省农业产业化龙头企业–凯里三辣明洋食品厂出产的酸汤底料形成黄金搭档确是一个非常好的良策；眼光再放远点，康师傅、统一、白象等名牌方便面和方便粉若配上8－10克启蒙酸菜调味袋岂不锦上添花。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/suan02.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>百度智能云IPv6搭建LNMP站点</title>
   <link href="https://comeround.cn/article/baidu-bcc-ipv6.html"/>
   <updated>2019-06-15T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/baidu-bcc-ipv6</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;为什么要做这件事？(前言、业务背景)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;        在互联网呈现爆炸式发展的今天， IPv4网络地址数量匮乏等问题将会影响到我国的互联网发展与应用，制约物联网、5G等新业务开展。今年4月国家工信部发布了《关于开展2019年IPv6网络就绪专项行动的通知》，重点任务包括网络基础设施IPv6能力就绪等。IPv6即互联网协议第6版，是互联网工程任务组（IETF）设计的用于替代IPv4的下一代IP协议，使用IPv6网络不仅能解决网络地址资源数量的问题，而且也解决了多种接入设备连入互联网的难题。5G时代即将来临，IPv6网络将成为互联网新业务发展与运用的强有力支撑。未来，个推也将不断打磨自身技术，积极探索并开展IPv4至IPv6之路，实现IPv6网络的全面启用。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://segmentfault.com/a/1190000019436642&quot;&gt;浅谈IPv4至IPv6演进的实施路径&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://cloud.baidu.com/video-center/video.html?id=341&quot;&gt;百度智能云-全系列云计算产品-百度生态独家支持&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://cloud.baidu.com/doc/BCC/GettingStarted/28.5C.E9.85.8D.E7.BD.AEipv6.E5.9C.B0.E5.9D.80.html&quot;&gt;配置BCC-ipv6地址&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;（1）本地环境检测：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;百度DNS：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2400:da00:2000:1f01::3&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;ipv6.baidu.com解析：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2400:da00:2::29&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;访问截图：（证明本地是有IPv6地址的）&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/baidu.com.ipv6.jpg&quot; alt=&quot;本地IPv6网络检测&quot; /&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;（2）服务器选购&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;BCC选购
    &lt;ul&gt;
      &lt;li&gt;区域选择：华北保定（目前只有华北保定region支持BCC-IPv6）&lt;/li&gt;
      &lt;li&gt;内存：2G、网络：1M&lt;/li&gt;
      &lt;li&gt;系统选择：CentOS7.6&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;配置EIP
    &lt;ul&gt;
      &lt;li&gt;拥有IPv4地址和IPv6地址（购买BCC请选择分配EIP）&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;配置VPC&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;1、BCC实例&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/baidu.bcc.ipv6.instance.jpg&quot; alt=&quot;BCC-IPv6实例&quot; /&gt;&lt;/p&gt;

&lt;p&gt;2、VPC实例&lt;/p&gt;

&lt;p&gt;主要参考这篇文档 &lt;a href=&quot;https://cloud.baidu.com/doc/VPC/GettingStarted/16.5C.E4.BD.BF.E7.94.A8IPv6.html&quot; target=&quot;\_blank&quot;&gt;配置IPv6 VPC&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;简单步骤如下：
    &lt;ul&gt;
      &lt;li&gt;创建一个新的VPC，勾选分配IPv6网段。&lt;/li&gt;
      &lt;li&gt;点击右侧分配IPv6网段&lt;/li&gt;
      &lt;li&gt;创建子网，勾选分配IPv6网段&lt;/li&gt;
      &lt;li&gt;创建IPv6公网网关（这个是要收费的）&lt;/li&gt;
      &lt;li&gt;配置IPv6安全组&lt;/li&gt;
      &lt;li&gt;配置IPv6路由&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;（其实文档写得很清除了，每个步骤总是缺一不可）&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/baidu.ipv6.vpc.jpg&quot; alt=&quot;VPC实例&quot; /&gt;&lt;/p&gt;

&lt;p&gt;路由配置：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;添加路由&lt;/code&gt;-&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IPv6&lt;/code&gt;-&amp;gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;路由类型&lt;/code&gt;选择&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IPv6公网网关&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/baidu.bcc.vpc.router.jpg&quot; alt=&quot;路由配置图&quot; /&gt;&lt;/p&gt;

&lt;p&gt;3、确认BCC已获取 IPv6 地址，并已连通IPv6外网&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@baidu-bcc ~]# ifconfig
eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt;  mtu 1500
        inet 172.16.0.8  netmask 255.255.240.0  broadcast 172.16.15.255
        inet6 240c:4082:0:1311::4  prefixlen 128  scopeid 0x0&amp;lt;global&amp;gt;
        inet6 fe80::f816:3eff:fe27:31c2  prefixlen 64  scopeid 0x20&amp;lt;link&amp;gt;
        ether fa:16:3e:27:31:c2  txqueuelen 1000  (Ethernet)
        RX packets 25136  bytes 267507090 (255.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 20665  bytes 3458303 (3.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73&amp;lt;UP,LOOPBACK,RUNNING&amp;gt;  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10&amp;lt;host&amp;gt;
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 909  bytes 413801 (404.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 909  bytes 413801 (404.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@bcc-test ~]# ping6 240c::6666 -c 5
PING 240c::6666(240c::6666) 56 data bytes
64 bytes from 240c::6666: icmp_seq=1 ttl=53 time=24.9 ms
64 bytes from 240c::6666: icmp_seq=2 ttl=53 time=24.3 ms
64 bytes from 240c::6666: icmp_seq=3 ttl=53 time=24.3 ms
64 bytes from 240c::6666: icmp_seq=4 ttl=53 time=24.3 ms
64 bytes from 240c::6666: icmp_seq=5 ttl=53 time=24.3 ms

--- 240c::6666 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 24.329/24.476/24.930/0.248 ms
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;（3）域名解析&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;将域名解析到一个IPv6地址 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;240c:4082:0:1310::4&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/baidu.ipv6.dns.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;（4）站点搭建&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;1、LNMP&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;安装&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wget http://soft.vpser.net/lnmp/lnmp1.6.tar.gz &lt;span class=&quot;nt&quot;&gt;-cO&lt;/span&gt; lnmp1.6.tar.gz &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;tar &lt;/span&gt;zxf lnmp1.6.tar.gz &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;lnmp1.6 &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;LNMP_Auto&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;y&quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;DBSelect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;5&quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;DB_Root_Password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;lnmppass&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;InstallInnodb&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;y&quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;PHPSelect&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;9&quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;SelectMalloc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1&quot;&lt;/span&gt; ./install.sh lnmp
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;2、Nginx配置&lt;/p&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;server&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;[::]:80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ipv6.ayouleyang.cn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.html&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.htm&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;default.html&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;default.htm&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;default.php&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;root&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;/home/www/web/public&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;# 省略部分代码&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;3、CURL测试&lt;/p&gt;

&lt;p&gt;CURL模拟浏览器请求 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl http://ipv6.ayouleyang.cn -v&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@bcc-test home]# curl &apos;http://\[240c:4082:0:1e03::4\]/&apos; --head -v
* About to connect() to 240c:4082:0:1e03::4 port 80 (#0)
*   Trying 240c:4082:0:1e03::4...
* Connected to 240c:4082:0:1e03::4 (240c:4082:0:1e03::4) port 80 (#0)
&amp;gt; HEAD / HTTP/1.1
&amp;gt; User-Agent: curl/7.29.0
&amp;gt; Host: [240c:4082:0:1e03::4]
&amp;gt; Accept: */*
&amp;gt;
&amp;lt; HTTP/1.1 200 OK
HTTP/1.1 200 OK
&amp;lt; Server: nginx/1.12.2
Server: nginx/1.12.2
&amp;lt; Date: Tue, 18 Jun 2019 08:47:47 GMT
Date: Tue, 18 Jun 2019 08:47:47 GMT
&amp;lt; Content-Type: text/html
Content-Type: text/html
&amp;lt; Content-Length: 3700
Content-Length: 3700
&amp;lt; Last-Modified: Fri, 10 May 2019 08:08:40 GMT
Last-Modified: Fri, 10 May 2019 08:08:40 GMT
&amp;lt; Connection: keep-alive
Connection: keep-alive
&amp;lt; ETag: &quot;5cd53188-e74&quot;
ETag: &quot;5cd53188-e74&quot;
&amp;lt; Accept-Ranges: bytes
Accept-Ranges: bytes

&amp;lt;
* Connection #0 to host 240c:4082:0:1e03::4 left intact
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Nginx直接返回用户IP：&lt;/p&gt;
&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/ip&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;default_type&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;text/html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kn&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$remote_addr&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;响应结果为：&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@bcc-test html]# curl http://ipv6.ayouleyang.cn/ip
240c:4082:0:1e03::4
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;手机端测试：（手机有运营商分配的IPv6）&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/baidu.bcc.ipv6.mobile.png&quot; alt=&quot;手机访问结果&quot; width=&quot;400px&quot; /&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;（5）开启双栈模式&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;1、同一个域名可以同时添加 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; 记录与 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AAAA&lt;/code&gt; 记录，一般来说，若有 IPv6 网络，优先解析 AAAA 记录，无 IPv6 网络下，则解析 A 记录。&lt;/p&gt;

&lt;p&gt;域名解析如下：&lt;/p&gt;
&lt;div class=&quot;language-conf highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;A&lt;/span&gt;       &lt;span class=&quot;m&quot;&gt;39&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;106&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;210&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;153&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;AAAA&lt;/span&gt;    &lt;span class=&quot;m&quot;&gt;240&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;:&lt;span class=&quot;m&quot;&gt;4082&lt;/span&gt;:&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;:&lt;span class=&quot;m&quot;&gt;1310&lt;/span&gt;::&lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Nginx双栈配置如下：&lt;/p&gt;
&lt;div class=&quot;language-conf highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;listen&lt;/span&gt;  [::]:&lt;span class=&quot;m&quot;&gt;80&lt;/span&gt;;
&lt;span class=&quot;n&quot;&gt;listen&lt;/span&gt;  &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;.&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;:&lt;span class=&quot;m&quot;&gt;80&lt;/span&gt;;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;词语解释：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
      &lt;p&gt;LNMP：即Linux系统下的 Nginx+PHP 生产环境。&lt;a href=&quot;https://lnmp.org/download.html&quot; target=&quot;_blank&quot;&gt;详见lnmp.org&lt;/a&gt; &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>使用Jekyll搭建个人博客</title>
   <link href="https://comeround.cn/article/make-a-blog-in-jekyll.html"/>
   <updated>2019-06-10T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/make-a-blog-in-jekyll</id>
   <content type="html">&lt;p&gt;参考文档：&lt;a href=&quot;https://mayanbin.com/post/compress-html-in-jekyll.html&quot;&gt;压缩Jekyll中的HTML和CSS代码&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;几年前，&lt;a href=&quot;http://markdotto.com/&quot;&gt;@mdo&lt;/a&gt; 开发了 Jekyll，如今已经成为最流行的静态博客网站生成器。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Jekyll 简介&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;如果你对这几个词比较陌生： hugo hexo jekyll pugo，可以参考： &lt;a href=&quot;https://gitee.com/help/articles/4136&quot;&gt;码云Pages-Jekyll、Hugo、Hexo编译静态资源&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;jekyll&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;是一个基于ruby语言，将纯文本转化为静态网站和博客的生成器，不需要数据库支持。&lt;a href=&quot;https://www.cnblogs.com/strick/p/5484779.html&quot;&gt;参考&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;一jekyll目录结构&quot;&gt;一、jekyll目录结构&lt;/h2&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;web
├── _includes
├── _layouts
├── _posts
├── _drafts
├─┬ public
│ └─┬─ css
│   ├─ images
│   └─ js
├── _config.yml
└── index.md
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;_config.yml - 这是一个你只需要编辑一次的配置文件，需要配置的变量包括你网站的title，你的邮箱等。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;_includes/ - 这个目录包含了你网站要重复加载的相同部分，比如网站的header和footer。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;_posts/ - 用于存放Markdown的博客文章，可以编写新的blog，可以根据网站的style进行渲染，只要文件名遵从jekyll的标准命名规则。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;_drafts/ - 用于存放未发布的文章，可以不用写日期，使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jekyll server --drafts&lt;/code&gt;启动即可看到文章。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;_layouts/ - 这个目录包含 该目录包含了用于设计某些类型的站点内的职位模板。例如，新的博客文章将使用post.html定义的HTML布局。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;_site/ - 这个目录是整个站点生成为静态文件的目录，该目录应该被加入.gitignore，若web空间不支持jekyll 可直接拷贝该目录也可发布。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;_data 配置变量&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;public/ - 这个目录可以放置其他静态文件。&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;头信息配置&quot;&gt;头信息配置&lt;/h3&gt;

&lt;p&gt;layout - 模板文件配置&lt;/p&gt;

&lt;p&gt;permalink - 自定义URL地址&lt;/p&gt;

&lt;p&gt;published - 是否生成静态文件&lt;/p&gt;

&lt;p&gt;category - 分类属性&lt;/p&gt;

&lt;p&gt;categories - 分类属性&lt;/p&gt;

&lt;p&gt;tags - 标签&lt;/p&gt;

&lt;h2 id=&quot;二使用jekyll生成个人博客&quot;&gt;二、使用jekyll生成个人博客&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;本地安装&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;安装ruby (略)&lt;/li&gt;
  &lt;li&gt;安装jekyll： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gem install jekyll&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;生成初始化博客： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jekyll new weblog&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;启动博客： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cd weblog; jekyll server&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Server address: http://127.0.0.1:4000/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;部署到 github Pages&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;首先你得有 github 账号&lt;/li&gt;
  &lt;li&gt;创建项目 建议创建项目名为 username.github.io&lt;/li&gt;
  &lt;li&gt;给该项目开通 gitpages&lt;/li&gt;
  &lt;li&gt;推送 git 到该项目，github自动生成静态页面&lt;/li&gt;
  &lt;li&gt;访问 https://[username].github.io/&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;三内置压缩机制&quot;&gt;三、内置压缩机制&lt;/h2&gt;

&lt;h3 id=&quot;1压缩-html-代码&quot;&gt;（1）压缩 HTML 代码&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/penibelst/jekyll-compress-html&quot;&gt;jekyll-compress-html&lt;/a&gt; 是一个使用 Jekyll layout 进行代码压缩的工具，意味着使用者不需要安装任何插件即可将站点部署到 GitHub Pages 上。&lt;/p&gt;

&lt;p&gt;使用起来也很方便：下载 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;compress.html&lt;/code&gt; 文件并保存到 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_layouts&lt;/code&gt;，然后修改顶层 layout 文件（比如 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_layouts/default.html&lt;/code&gt;），把它引用进去：&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;compress&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;最后，在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_config.yml&lt;/code&gt; 中配置相应的压缩选项，比如我的：&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;compress_html&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;clippings&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;comments&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;       &lt;span class=&quot;pi&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;lt;!--&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;--&amp;gt;&quot;&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;endings&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;        &lt;span class=&quot;s&quot;&gt;all&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;startings&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;      &lt;span class=&quot;pi&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;详细的配置文档可以在&lt;a href=&quot;http://jch.penibelst.de/&quot;&gt;官方网站&lt;/a&gt;上找到。&lt;/p&gt;

&lt;h3 id=&quot;2压缩-css-代码&quot;&gt;（2）压缩 CSS 代码&lt;/h3&gt;

&lt;p&gt;Jekyll 原生支持 Sass，所以我决定使用 SASS 进行 CSS 文件的合并和压缩。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;1、修改 Sass 配置&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;因为我的 CSS 文件全部在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;public/css&lt;/code&gt; 目录下，所以首先需要在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_config.yml&lt;/code&gt; 中配置 Sass 目录来代替默认的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_sass&lt;/code&gt;；同时配置 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;style&lt;/code&gt; 选项，使得最后输出结果是压缩格式的：&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;sass&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;sass_dir&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;       &lt;span class=&quot;s&quot;&gt;/public/css&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;          &lt;span class=&quot;s&quot;&gt;compressed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;2、创建 Sass 样式文件&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;将当前 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;public/css&lt;/code&gt; 目录中的所有 CSS 文件后缀改为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.scss&lt;/code&gt;，并新建文件 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;styles.scss&lt;/code&gt;，用于将其他 Sass 文件合并到一起：&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;web
├── _includes
├── _layouts
├── _posts
├─┬ public
│ └─┬ css
│   ├── highlight.scss
│   ├── hyde.scss
│   ├── poole.scss
│   └── styles.scss
├── _config.yml
└── index.html
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;styles.scss&lt;/code&gt;， 中，使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@import&lt;/code&gt; 语句导入其他的 Sass 文件，这样最终 Jekyll 在编译 Sass 的时候便会将其合并为一个 CSS 文件。注意，需要在文件顶部加入 &lt;a href=&quot;https://jekyllrb.com/docs/frontmatter/&quot;&gt;Front Matter&lt;/a&gt; 块，否则会报错：&lt;/p&gt;

&lt;div class=&quot;language-sass highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;Front&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;matter&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;comment&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;ensure&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;Jekyll&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;properly&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;reads&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;---&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;@charset&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Imports sass/scss files&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@import&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;poole&quot;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@import&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;hyde&quot;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@import&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;highlight&quot;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;3、引入编译后的样式文件&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;最后，在 HTML layout 的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;head&amp;gt;&lt;/code&gt; 标签中引入编译后的样式文件。Jekyll 会自动将 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.scss&lt;/code&gt; 文件转化为相应的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.css&lt;/code&gt; 文件，所以这里只需要引入 CSS 文件即可：&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;link&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rel=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;stylesheet&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/public/css/styles.css&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;最后，优化之后的代码，可以右键查看本页的源代码进行查看。&lt;/p&gt;

&lt;h2 id=&quot;四配置和依赖&quot;&gt;四、配置和依赖&lt;/h2&gt;

&lt;h3 id=&quot;配置&quot;&gt;配置&lt;/h3&gt;

&lt;p&gt;_post目录生成html规则，article 即为目录名&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;permalink:        /article/:title.html
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;默认生成：_site/jekyll/update/2019/06/10/demo.html&lt;/p&gt;

&lt;h3 id=&quot;依赖&quot;&gt;依赖&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;安装bundler工具：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gem install bundler&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;升级包：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bundle update&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;五扩展配置&quot;&gt;五、扩展配置&lt;/h2&gt;

&lt;p&gt;如果您觉得样式不够用，可以自己设置样式，然后兼容html语法&lt;/p&gt;

&lt;p&gt;1）添加样式&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;使用html样式
{:.message}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;效果如下：&lt;/p&gt;

&lt;div class=&quot;message&quot;&gt;使用html样式&lt;/div&gt;

&lt;p&gt;自定义其他样式：&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;.message-a&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;rgba&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;22&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;184&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;248&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;.1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;使用html样式-A
{:.message .message-a}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p class=&quot;message message-a&quot;&gt;使用html样式-A&lt;/p&gt;

&lt;div class=&quot;message message-b&quot;&gt;使用html样式-B&lt;/div&gt;

&lt;div class=&quot;message message-c&quot;&gt;使用html样式-C&lt;/div&gt;

&lt;div class=&quot;message message-d&quot;&gt;使用html样式-D&lt;/div&gt;

&lt;div class=&quot;message message-e&quot;&gt;使用html样式-E&lt;/div&gt;

&lt;div class=&quot;message message-f&quot;&gt;使用html样式-F&lt;/div&gt;

&lt;p&gt;2）修改样式&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;h3&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;block&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;300&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;background-image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;linear-gradient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;#fff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;#8BC34A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;#4CAF50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;#4CAF50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;#4CAF50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;#8BC34A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;#FFF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;#4CAF50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;#FFF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1.4em&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2em&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;14px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;10px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;10px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;letter-spacing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;text-shadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1px&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;#666&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;text-align&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;center&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;h4&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;block&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;background-image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;linear-gradient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;#4CAF50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;#8BC34A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;#8BC34A&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;#FFF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;#4CAF50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;#FFF&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1.2em&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2em&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;10px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;12px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;10px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;8px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;10px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;8px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;15px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;letter-spacing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;border-left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;solid&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;#333&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;6px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;text-shadow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1px&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;#666&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;效果：&lt;/p&gt;

&lt;h3 id=&quot;这是测试的h3效果&quot;&gt;这是测试的H3效果&lt;/h3&gt;

&lt;h4 id=&quot;这是测试的h4效果&quot;&gt;这是测试的H4效果&lt;/h4&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;六常用变量&quot;&gt;六、常用变量&lt;/h2&gt;

&lt;h5 id=&quot;常用变量&quot;&gt;常用变量&lt;/h5&gt;

&lt;blockquote&gt;
  &lt;p&gt;Jekyll 会遍历你的网站搜寻要处理的文件。任何有 YAML 头信息的文件都是要处理的对象。对于每一个这样的文件，Jekyll 都会通过 Liquid 模板工具来生成一系列的数据。下面就是这些可用数据变量的参考和文档。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5 id=&quot;全局global变量&quot;&gt;全局(Global)变量&lt;/h5&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;变量&lt;/th&gt;
      &lt;th&gt;说明&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;site&lt;/td&gt;
      &lt;td&gt;来自_config.yml文件，全站范围的信息+配置。详细的信息请参考下文&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;page&lt;/td&gt;
      &lt;td&gt;页面专属的信息 + YAML 头文件信息。通过 YAML 头文件自定义的信息都可以在这里被获取。详情请参考下文。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;content&lt;/td&gt;
      &lt;td&gt;被 layout 包裹的那些 Post 或者 Page 渲染生成的内容。但是又没定义在 Post 或者 Page 文件中的变量。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;paginator&lt;/td&gt;
      &lt;td&gt;每当 paginate 配置选项被设置了的时候，这个变量就可用了。详情请看分页。&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h5 id=&quot;全站site变量&quot;&gt;全站(site)变量&lt;/h5&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;变量&lt;/th&gt;
      &lt;th&gt;说明&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;site.time&lt;/td&gt;
      &lt;td&gt;当前时间（运行jekyll这个命令的时间点）。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;site.pages&lt;/td&gt;
      &lt;td&gt;所有 Pages 的清单。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;site.posts&lt;/td&gt;
      &lt;td&gt;一个按照时间倒序的所有 Posts 的清单。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;site.related_posts&lt;/td&gt;
      &lt;td&gt;如果当前被处理的页面是一个 Post，这个变量就会包含最多10个相关的 Post。默认的情况下， 相关性是低质量的，但是能被很快的计算出来。如果你需要高相关性，就要消耗更多的时间来计算。 用jekyll 这个命令带上 --lsi (latent semantic indexing) 选项来计算高相关性的 Post。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;site.categories.CATEGORY&lt;/td&gt;
      &lt;td&gt;所有的在 CATEGORY 类别下的帖子。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;site.tags.TAG&lt;/td&gt;
      &lt;td&gt;所有的在 TAG 标签下的帖子。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;site.[CONFIGURATION_DATA]&lt;/td&gt;
      &lt;td&gt;所有的通过命令行和 _config.yml 设置的变量都会存到这个 site 里面。 举例来说，如果你设置了 url: http://mysite.com 在你的配置文件中，那么在你的 Posts 和 Pages 里面，这个变量就被存储在了 site.url。Jekyll 并不会把对 _config.yml 做的改动放到 watch 模式，所以你每次都要重启 Jekyll 来让你的变动生效。&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h5 id=&quot;页面page变量&quot;&gt;页面(page)变量&lt;/h5&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;变量&lt;/th&gt;
      &lt;th&gt;说明&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;page.content&lt;/td&gt;
      &lt;td&gt;页面内容的源码。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;page.title&lt;/td&gt;
      &lt;td&gt;页面的标题。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;page.excerpt&lt;/td&gt;
      &lt;td&gt;页面摘要的源码。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;page.url&lt;/td&gt;
      &lt;td&gt;帖子以斜线打头的相对路径，例子： /2008/12/14/my-post.html。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;page.date&lt;/td&gt;
      &lt;td&gt;帖子的日期。日期的可以在帖子的头信息中通过用以下格式YYYY-MM-DD HH:MM:SS (假设是 UTC), 或者YYYY-MM-DD HH:MM:SS +/-TTTT ( 用于声明不同于 UTC 的时区， 比如 2008-12-14 10:30:00 +0900) 来显示声明其他 日期/时间 的方式被改写，&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;page.id&lt;/td&gt;
      &lt;td&gt;帖子的唯一标识码（在RSS源里非常有用），比如/2008/12/14/my-post&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;page.categories&lt;/td&gt;
      &lt;td&gt;这个帖子所属的 Categories。Categories 是从这个帖子的 _posts以上 的目录结构中提取的。距离来说, 一个在 /work/code/_posts/2008-12-24-closures.md 目录下的 Post，这个属性就会被设置成 [‘work’, ‘code’]。不过 Categories 也能在YAML 头文件信息 中被设置。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;page.tags&lt;/td&gt;
      &lt;td&gt;这个 Post 所属的所有 tags。Tags 是在YAML 头文件信息中被定义的。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;page.path&lt;/td&gt;
      &lt;td&gt;Post 或者 Page 的源文件地址。举例来说，一个页面在 GitHub 上的源文件地址。 这可以在 YAML 头文件信息 中被改写。&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h5 id=&quot;分页器paginator&quot;&gt;分页器(Paginator)&lt;/h5&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;变量&lt;/th&gt;
      &lt;th&gt;说明&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;paginator.per_page&lt;/td&gt;
      &lt;td&gt;每一页 Posts 的数量。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;paginator.posts&lt;/td&gt;
      &lt;td&gt;这一页可用的 Posts。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;paginator.total_posts&lt;/td&gt;
      &lt;td&gt;Posts 的总数。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;paginator.total_pages&lt;/td&gt;
      &lt;td&gt;Pages 的总数。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;paginator.page&lt;/td&gt;
      &lt;td&gt;当前页号。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;paginator.previous_page&lt;/td&gt;
      &lt;td&gt;前一页的页号。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;paginator.previous_page_path&lt;/td&gt;
      &lt;td&gt;前一页的地址。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;paginator.next_page&lt;/td&gt;
      &lt;td&gt;下一页的页号。&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;paginator.next_page_path&lt;/td&gt;
      &lt;td&gt;下一页的地址。&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;七jekyll语法&quot;&gt;七、Jekyll语法&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Jekyll的模板语法使用 Liquid&lt;sup id=&quot;fnref:4&quot;&gt;&lt;a href=&quot;#fn:4&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5 id=&quot;循环反向排序并循环输出前10-20条文章&quot;&gt;循环：反向排序并循环输出前10-20条文章&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;{ % for post in site.posts limit:20 offset:10 reversed %}
    { { post.title }} { { post.excerpt | remove: &apos;fuck&apos; }}
{ % endfor %}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;判断and-且-or-或-contains-包含&quot;&gt;判断：and 且 or 或 contains 包含&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;{ % if page.excerpt %}
    { { page.excerpt| strip_html }}
{ % elsif page.description %}
    { { page.description }}
{ % else %}
    { { site.description }}
{ % endif %}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;多条件&quot;&gt;多条件&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;{ % case condition %}
    { % when 1 %}
    here is 1
    { % when 2 or 3 %}
    herer is 2 or 3
    { % else %}
    ... else ...
{ % endcase %}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;赋值&quot;&gt;赋值&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;{ % assign index = 1 %}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;代码高亮显示行号-linenos-支持的语言参考rough-wiki&quot;&gt;代码高亮：显示行号 linenos 支持的语言参考Rough Wiki&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;{% highlight js linenos %}
	console.log(&apos;Hello world!&apos;)
{% endhighlight %}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h5 id=&quot;不解析代码&quot;&gt;不解析代码&lt;/h5&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;{ % raw %}
...liquid代码
{ % endraw %}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;八hyde和poole介绍&quot;&gt;八、Hyde和Poole介绍&lt;/h2&gt;

&lt;p&gt;Hyde&lt;sup id=&quot;fnref:2&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;3&lt;/a&gt;&lt;/sup&gt;是一个厚颜无耻的双列Jekyll主题，它将突出的侧边栏与简单的内容配对。它基于Jekyll管家Poole&lt;sup id=&quot;fnref:3&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot; role=&quot;doc-noteref&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;。&lt;/p&gt;

&lt;p&gt;该博客是基于&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Jekyll and Hyde and Poole&lt;/code&gt;的主题&lt;a href=&quot;http://jekyllthemes.org/themes/hydeout/&quot;&gt;Hydeout&lt;/a&gt;结合&lt;a href=&quot;https://hydejack.com/&quot;&gt;hydejack&lt;/a&gt;制作的。Jekyll是程序，Hyde是主题，Poole更精致。&lt;/p&gt;

&lt;h2 id=&quot;九部署jekyll博客&quot;&gt;九、部署Jekyll博客&lt;/h2&gt;

&lt;p&gt;如果您需要使用自己的服务器的话，使用&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jekyll build&lt;/code&gt;生成静态文件存放在&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_site&lt;/code&gt;目录，把该目录文件复制到自己的Nginx(Apache)路径发布即可。&lt;/p&gt;

&lt;p&gt;如果您需要使用git托管，建议放在github，或者gitee，或者coding托管，使用git pages功能直接自动部署，无需拷贝_site目录。&lt;/p&gt;

&lt;h2 id=&quot;十不错的jekyll静态站点&quot;&gt;十、不错的jekyll静态站点&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://lorepirri.github.io/cayman-blog/&quot;&gt;cayman-blog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://nrandecker.github.io/particle/&quot;&gt;particle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://janczizikow.github.io/sleek/&quot;&gt;sleek&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://materialdesignthemes.com/themes/material-template-with-jekyll/&quot;&gt;https://github.com/naveenshaji/material&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://lzz5235.github.io/&quot;&gt;JasonLe’s Blog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/P233/3-Jekyll&quot;&gt;3-Jekyll&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;更多主题：http://jekyllthemes.org&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;注释&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;其他博客&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;https://2heng.xin/2017/06/05/jekyll/&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;参考文章&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.csdn.net/sunxboy/article/details/84693928&quot;&gt;jekyll中的常用变量&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.manongjc.com/detail/12-zkqwgaoasuwszyc.html&quot;&gt;jekyll模板、语法&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.dazhuanlan.com/2019/09/25/5d8ade56f342c/&quot;&gt;jekyll模板、语法|大专栏&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;http://hyde.getpoole.com/&quot;&gt;Jekyll&lt;/a&gt; &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:4&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://liquid.bootcss.com/basics/introduction/&quot;&gt;Liquid&lt;/a&gt; &lt;a href=&quot;#fnref:4&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;http://hyde.getpoole.com/&quot;&gt;Hyde&lt;/a&gt; &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;http://getpoole.com/&quot;&gt;Poole&lt;/a&gt; &lt;a href=&quot;#fnref:3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>基于swoole实现的实时聊天工具</title>
   <link href="https://comeround.cn/article/swoole-socket-chat.html"/>
   <updated>2019-06-06T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/swoole-socket-chat</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;前言&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;虽然网上有很多swoole实现的实时聊天工具，但是模仿起来还是遇到很多问题，以前已经实现过swoole的聊天室，现在把整个步骤写成一个文档。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;1、搭建swoole环境要求&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;Linux（CentOS 7.6）&lt;/li&gt;
  &lt;li&gt;PHP (PHP 7.3)&lt;/li&gt;
  &lt;li&gt;swoole (swoole4.3.4)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;安装PHP（略）&lt;/p&gt;

&lt;p&gt;安装swoole&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pecl &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;swoole
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;2、编写前端页面&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;底部的样式&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nc&quot;&gt;.bottom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;absolute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;z-index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;98%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;56px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;bottom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;inline-block&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;效果图&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/swoole-websocket-01.jpg&quot; alt=&quot;&quot; class=&quot;demo-images&quot; /&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;3、写js脚本实现websocket连接&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;socket_url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;ws://www.xxxx.cn:9502&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ws&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//连接&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;nick&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;用户昵称&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;online&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;// 在线状态&lt;/span&gt;
&lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// 直接连接&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ws&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;WebSocket&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;socket_url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ws&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onopen&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;online&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;p&amp;gt;连接服务器成功。&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ws&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onmessage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;rec&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;time&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;rec&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;rec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;rec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#sockmsg&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;li&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;
                &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;span class=&quot;name&quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;rec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;/span&amp;gt;： &amp;lt;br&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;
                &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;span class=&quot;content&quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;rec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#sockmsg&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;span class=&quot;color-s&quot;&amp;gt;系统消息&amp;amp;nbsp;&amp;amp;nbsp;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;toLocaleString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ws&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onclose&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;online&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nf&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;您已离线&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// 发送消息&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#send&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;trim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#content&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;nick&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;online&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;param&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{};&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;nick&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;发送消息：&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
            &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#content&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#sockmsg&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;li&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;
                &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;span class=&quot;name me&quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;nick&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;/span&amp;gt;： &amp;lt;br&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;
                &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;span class=&quot;content&quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;ws&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nf&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;您已掉线&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;4、联合swoole开发调试&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;swoole程序代码&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;\swoole_websocket_server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0.0.0.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9501&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;open&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;message&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$receive&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_decode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$frame&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;foreach&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;connections&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$fd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;isEstablished&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$fd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$fd&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$frame&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$fd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;json_encode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$receive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;close&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$fd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;$server&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;运行：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nohup php demo.php &amp;amp;&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;5、配置wss连接&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;使用Nginx代理websocket连接，即可使https站点支持wss连接，操作方法如下：&lt;/p&gt;

&lt;p&gt;1、配置Nginx代理socket接口&lt;/p&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;server&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;443&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ssl&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;http2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;#listen [::]:443 ssl http2;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;www.websocket.com&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.html&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.htm&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;default.html&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;default.htm&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;default.php&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;root&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;/home/www/web/public/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;# 配置ssl证书代码&lt;/span&gt;
        &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/websocket&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;kn&quot;&gt;proxy_pass&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;http://127.0.0.1:9501&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;X-Real-IP&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$remote_addr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;kn&quot;&gt;proxy_read_timeout&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;600&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Host&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;X-Forwarded-For&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$proxy_add_x_forwarded_for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;kn&quot;&gt;proxy_http_version&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Upgrade&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$http_upgrade&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;kn&quot;&gt;proxy_set_header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Connection&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;upgrade&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;2、连接地址如下&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wss://www.websocket.com/websocket&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;6、多终端测试&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;PC浏览器测试&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/swoole-websocket-02.jpg&quot; alt=&quot;&quot; class=&quot;demo-images&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;手机端测试&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/swoole-websocket-03.png&quot; alt=&quot;&quot; class=&quot;demo-images&quot; /&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;7、线上运行跟踪&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;本系统已正常运行一个周（从开始运行到现在已经一个周啦）&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;查看系统进程&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@aliecs websocket]# ps aux|grep think
root     14023  0.0  0.7 340596 14496 ?        S    19:40   0:00 php think ws6
root     15539  0.0  2.2 405928 43252 ?        Sl   Jun11   0:09 php think ws6
root     15549  0.0  0.5 333956 10516 ?        S    Jun11   0:00 php think ws6
root     15583  0.0  0.7 338412 14208 ?        S    20:05   0:00 php think ws
root     32593  0.0  2.4 405928 46024 ?        Sl   15:55   0:00 php think ws
root     32603  0.0  0.5 333956 10588 ?        S    15:55   0:00 php think ws
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;root@aliecs websocket]#
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;8、项目扩展&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;对该系统新增禁言功能；&lt;/li&gt;
  &lt;li&gt;添加用户头像显示；&lt;/li&gt;
  &lt;li&gt;增加图片发送和显示；&lt;/li&gt;
  &lt;li&gt;记录并重新显示聊天记录。&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>义务劳动系统相关</title>
   <link href="https://comeround.cn/article/my-php-website-note.html"/>
   <updated>2019-06-05T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/my-php-website-note</id>
   <content type="html">&lt;style&gt;
.post&gt;p {
    text-indent: 2em;
    margin-bottom: 10px;
}&lt;/style&gt;

&lt;h2 id=&quot;前言&quot;&gt;前言&lt;/h2&gt;

&lt;p&gt;我最开始想做这个系统的时候是2014年上半年，但是那时候只是想想，首先没什么技术，也没什么资源，并且那时候对我来说关系不大。直到2015年下半年，我负责信息学院的学生资助上的事务，便想着如何安排整个学院的义务劳动，开始做了一个报名功能。那时候，刚开始学写asp.net MVC网页，便做了个能输入学号和生日进行报名，使用的是学校内网，就是http://10.24.32.xx做服务器地址，当然，这样手机连接4G网络是访问不了的，需要报名的时候，才开服务器，要么使用校园网络上网报名，要么使用电脑开热点使用手机连WIFI报名。大概也就是2015年下半年用了一次，2016年上半年用了一次。&lt;/p&gt;

&lt;p&gt;我是2016年暑假开始接触PHP语言的。是由于有个电子商务女生要我帮忙做个PHP网页，实现增删改查功能，从此，我便开始以PHP为主要的开发语言。当时，在逛网的时候发现有个叫“百家云”的虚拟主机服务商（现在已改名为“硅云”），试着PHP代码上传到虚拟主机，那时候才知道域名是怎么解析的。后来，9月份在QQ群里有人卖PHP教程，10块钱便宜把视频卖给了我，我便开始学习PHP、ThinkPHP3.2.3、Linux以及一些数据库知识。觉得PHP还是比asp.net好学也好用，搭建起网站也快得多。&lt;/p&gt;

&lt;p&gt;2016年11月开始，便是用系统来提供报名及登记学生所做义务劳动，但是由于功能不全，网页访问效果也不太好，所以只是部分人在用。我便是从2017年5月开始写的现在这个版本，那时候我刚毕业答辩完，忙着工作的同时，也抽些周末的时间在做，大概到10月份，就正式投入使用了。有一次是有好几十个人的报名名额，访问量过大，直接是导致所有人访问都响应服务器繁忙，当然，硅云3的服务器是肯定抵挡不住的，应对个人访问还行。2018年3月，开始使用阿里云学生机ECS服务器，当时记录2分钟内50个人报名是没问题的，后来也有过超过1人/秒的记录。2018年9月，开始修改成多学院模式，2018年11月公管学院加入使用，2019年4月数统学院加入使用。&lt;/p&gt;

&lt;p&gt;经过不断的完善，日志已经由MongoDB保存，由Redis做数据缓存。已基本满足现在的使用需求。有这个系统，第一主要是因为有这个需求，第二也是学院老师和同学的支持，当然最主要的还是我这一颗永不改变的初心。&lt;/p&gt;

&lt;div style=&quot;display:none;&quot;&gt;
直到20年下半年，刘老师离开了信息学院，资助工作由其他老师管理。
&lt;/div&gt;

&lt;h2 id=&quot;技术总览&quot;&gt;技术总览：&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;PHP7.3.6+&lt;/li&gt;
  &lt;li&gt;ThinkPHP5.1.36+&lt;/li&gt;
  &lt;li&gt;Nginx1.16.0+&lt;/li&gt;
  &lt;li&gt;MySQL8.0.15+&lt;/li&gt;
  &lt;li&gt;MongoDb4.0.6+&lt;/li&gt;
  &lt;li&gt;Redis5.0.5+&lt;/li&gt;
  &lt;li&gt;LayUI2.5.4+&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Git/Composer/postgresql/Websocket/vue.js&lt;/p&gt;

&lt;h2 id=&quot;功能&quot;&gt;功能&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;支持多学院&lt;/li&gt;
  &lt;li&gt;重置密码&lt;/li&gt;
  &lt;li&gt;websocket聊天室&lt;/li&gt;
  &lt;li&gt;Excel导出报表&lt;/li&gt;
  &lt;li&gt;信息收集&lt;/li&gt;
  &lt;li&gt;增加ipv6支持&lt;/li&gt;
  &lt;li&gt;QQ绑定及登录功能&lt;/li&gt;
  &lt;li&gt;权限分级&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;版本更新&quot;&gt;版本更新：&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;更新日期&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;版本&lt;/th&gt;
      &lt;th&gt; &lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2018-06-12&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.0.0A1&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2018-09-10&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.0.0B1&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2018-09-25&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.0.0&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2018-10-12&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.0.1&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2018-10-28&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.0.2&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2018-11-09&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.0.3&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2018-11-15&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.1.0&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2018-12-03&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.1.1&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2018-12-20&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.1.2&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2019-01-09&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.2.0&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2019-03-01&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.2.1&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2019-04-01&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.2.2&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2019-05-05&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.2.3&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2019-06-01&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.2.4&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2019-07-05&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.2.5&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2019-09-01&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.3.0&lt;/td&gt;
      &lt;td&gt;支持短信登录，兼容Tengine&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2020-01-01&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.3.1&lt;/td&gt;
      &lt;td&gt;常规更新，功能冻结&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;2021-03-01&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;4.4.0&lt;/td&gt;
      &lt;td&gt;支持PHP8.0&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;部署说明&quot;&gt;部署说明&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;复制config/database.php.example文件为config/database.php，并修改数据库配置&lt;/li&gt;
  &lt;li&gt;安装swoole、安装redis、安装mongodb&lt;/li&gt;
  &lt;li&gt;使用composer install安装依赖&lt;/li&gt;
  &lt;li&gt;配置Nginx重写（略）&lt;/li&gt;
  &lt;li&gt;给予runtime目录可写权限&lt;/li&gt;
  &lt;li&gt;部署缓存&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bash extend/admin/init.sh&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;其他功能&quot;&gt;其他功能&lt;/h1&gt;

&lt;h4 id=&quot;swoole-websocket聊天功能使用方法&quot;&gt;Swoole-Websocket聊天功能使用方法&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;启动服务端监听 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;php think ws&lt;/code&gt;，守护进程添加&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;amp;&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;使用http代替https&lt;/li&gt;
  &lt;li&gt;说明:该功能使用纯的swoole扩展，没有使用think-swoole&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;文件服务器&quot;&gt;文件服务器&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;上传参数
    &lt;ul&gt;
      &lt;li&gt;file  文件&lt;/li&gt;
      &lt;li&gt;cate  类型，默认images，用于文件夹分类&lt;/li&gt;
      &lt;li&gt;filename  文件名，若存在，则放入extend/database目录中&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;响应参数&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;state&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;msg&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;上传成功&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;data&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;214757780300360.crt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;application/x-x509-ca-cert&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;tmp_name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/tmp/phpHYM1uU&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;error&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;size&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3737&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;src&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/uploads/texxt/20190515/036acc9d4e5c3acd41b30689521894d4.crt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;ext&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;crt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;saveName&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;036acc9d4e5c3acd41b30689521894d4.crt&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;开发参考&quot;&gt;开发参考&lt;/h2&gt;
&lt;p&gt;请参阅 &lt;a href=&quot;https://github.com/top-think/framework&quot;&gt;ThinkPHP5 核心框架包&lt;/a&gt;。&lt;/p&gt;

&lt;h3 id=&quot;作者linzening联系linzeningqqcom&quot;&gt;作者：linzening、联系：linzening@qq.com&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;数据库刷新表统计&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;ANALYZE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;TABLE&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;`b_volunteer`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`b_userinfo`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`b_store`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`b_release`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;`b_shipwall`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;PHP代码&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;//管理员列表&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;showlist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;assign&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;info&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ExtAdmin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;adminlist&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;assign&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;isadmin&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;session&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;admin.role&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;yes&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;no&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;页面预览&quot;&gt;页面预览&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/yiwulaodongv1.1-register.png&quot; alt=&quot;版本1.1报名（2016）&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/yiwulaodongv1.1-reg_list.png&quot; alt=&quot;版本1.1名单（2016）&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/yiwulaodong-pre_index.jpg&quot; alt=&quot;首页预览&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/yiwulaodong-pre_admin.jpg&quot; alt=&quot;管理预览&quot; /&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>从这里，开始我的博客</title>
   <link href="https://comeround.cn/article/write-a-blog.html"/>
   <updated>2019-06-04T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/write-a-blog</id>
   <content type="html">&lt;p&gt;著名的博客大神阮一峰，曾经说过&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;对于喜欢写博客的人而言，一般会经历三个阶段
第一阶段，刚接触Blog，觉得很新鲜，试着选择一个免费空间来写。
第二阶段，发现免费空间限制太多，就自己购买域名和空间，搭建独立博客。
第三阶段，觉得独立博客的管理太麻烦，最好在保留控制权的前提下，让别人来管，自己只负责写文章。
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;&lt;del&gt;你 就应该为以后的你留下点什么！&lt;/del&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;虽然我写的博客还很少，但一直想拥有一个自己的博客，还是懒得动手（页面写得丑，数据库维护繁杂，没有固定服务器，迁移最麻烦）。&lt;/p&gt;

&lt;p&gt;所以，我想有一个前端静态页面的博客，不用考虑迁移服务器，不用自己搭，我只想要一个容易维护的博客程序，兼容MarkDown语法，支持Git全备份。要不然，我是不会去自己开发的。&lt;/p&gt;

&lt;p&gt;就在今天，我到github上看到&lt;a href=&quot;https://myanbin.github.io/&quot;&gt;饮冰先生&lt;/a&gt;的博客，于是打算开始编写我的博客。而今天，这个博客终于问世了（其实主要是“复制”，然后改内容），以后再把以前写的文档加上来，就有了伴随一生的博客。&lt;/p&gt;

&lt;p&gt;而GitHub(gitpages)的存在，就等于为我免费托管了网站的代码，我可以高枕无忧地专心写我的博客就行了，无需担心网站迁移等等之类的问题。&lt;/p&gt;

&lt;p&gt;如果你喜欢这个博客，可以下载饮冰先生的&lt;a href=&quot;https://github.com/myanbin/myanbin.github.io&quot;&gt;源代码&lt;/a&gt;进行修改。&lt;/p&gt;

&lt;p&gt;Jekyll 是用 Ruby 开发的一个静态站点生成器，它会根据网页源码生成静态文件。它提供了模板、变量、插件等功能，所以实际上可以用来编写整个网站。只需要使用下面的几行命令，就可以在本地生成一个博客：&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;ybm@localhost ~]&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;gem &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;jekyll
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;ybm@localhost ~]&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;jekyll new myblog
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;ybm@localhost ~]&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;myblog
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;ybm@localhost myblog]&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;jekyll server
&lt;span class=&quot;c&quot;&gt;# =&amp;gt; Now browse to http://localhost:4000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;最后，利用 GitHub Page，将博客源代码部署到 GitHub 上去，便可以得到一个使用版本控制，可以在本地用 &lt;a href=&quot;http://wowubuntu.com/markdown/basic.html&quot;&gt;Markdown&lt;/a&gt; 写作的简单快速的静态博客系统了。&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>&lt;span style=&quot;color:red;&quot;&gt;看这里看这里</title>
   <link href="https://comeround.cn/article/books-you-can-read.html"/>
   <updated>2019-01-01T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/books-you-can-read</id>
   <content type="html">&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.postgres.cn/docs/10/&quot;&gt;PostgreSql10手册&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://git-scm.com/book/zh/v2/起步-关于版本控制&quot;&gt;Git版本控制&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.52im.net/topic-tcpipvol1.html&quot;&gt;TCP/IP详解-卷1：协议&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#&quot;&gt;HTTP权威指南&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;#&quot;&gt;CDN技术详解&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.52im.net/thread-258-1-1.html&quot;&gt;理论经典：TCP协议的3次握手与4次挥手过程详解&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;资源网站&quot;&gt;资源网站&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;http://www.52im.net/&quot;&gt;及时通讯网&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.52im.net/forum.php?mod=viewthread&amp;amp;tid=516&amp;amp;highlight=Node&quot;&gt;一个WebSocket实时聊天室Demo：基于node.js+socket.io&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>技术栈+读书</title>
   <link href="https://comeround.cn/article/which-books-i-read-in-2018.html"/>
   <updated>2018-12-03T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/which-books-i-read-in-2018</id>
   <content type="html">&lt;p&gt;
&lt;span style=&quot;background-color: rgb(30, 155, 232);padding:6px 12px;border-radius: 2px;color:#fefefe;&quot;&gt;☆&lt;/span&gt;
&lt;span style=&quot;background-color: rgb(123, 196, 241);padding:6px 12px;border-radius: 2px;color:#ffffff;&quot;&gt;计算机技术+学习&lt;/span&gt;
&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;技术，从无到有（2018年）&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;Node.js&lt;/li&gt;
  &lt;li&gt;Vue.js&lt;/li&gt;
  &lt;li&gt;MongoDb&lt;/li&gt;
  &lt;li&gt;PgSql&lt;/li&gt;
  &lt;li&gt;Composer&lt;/li&gt;
  &lt;li&gt;Git&lt;/li&gt;
  &lt;li&gt;Ansible&lt;/li&gt;
  &lt;li&gt;Scrapy&lt;/li&gt;
  &lt;li&gt;Flask&lt;/li&gt;
  &lt;li&gt;websocket&lt;/li&gt;
  &lt;li&gt;PHP(Workerman/Swoole)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;《Linux就该这样学》&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;2019年&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;gitpages&lt;/li&gt;
  &lt;li&gt;websocket++&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;《数据库工程师考试》&lt;/p&gt;

&lt;p&gt;《网络工程师考试》&lt;/p&gt;

&lt;p&gt;《网络工程师5天修炼》&lt;/p&gt;

&lt;p&gt;《计算机网络2019高分笔记》&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;2020年&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;TCP/IP抓包&lt;/li&gt;
  &lt;li&gt;IPv6&lt;/li&gt;
  &lt;li&gt;SVN&lt;/li&gt;
  &lt;li&gt;MySQL/主从&lt;/li&gt;
  &lt;li&gt;Elasticsearch&lt;/li&gt;
  &lt;li&gt;网络工程师中级证书(2020-11)&lt;/li&gt;
  &lt;li&gt;Redis应用&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;2021年&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;WPF简单程序&lt;/li&gt;
  &lt;li&gt;Docker&lt;/li&gt;
  &lt;li&gt;Go&lt;/li&gt;
  &lt;li&gt;.net core&lt;/li&gt;
  &lt;li&gt;Docsify&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;2022年&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;高中数学&lt;/li&gt;
  &lt;li&gt;《高等数学》&lt;/li&gt;
  &lt;li&gt;线性代数&lt;/li&gt;
  &lt;li&gt;Go语言、Gin框架、命令程序&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;2023年&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;暂无&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h6 id=&quot;其他小笔记&quot;&gt;其他小笔记&lt;/h6&gt;

&lt;ul&gt;
  &lt;li&gt;.NET
    &lt;ul&gt;
      &lt;li&gt;.net core：跨平台的服务端&lt;/li&gt;
      &lt;li&gt;WPF：桌面应用程序&lt;/li&gt;
      &lt;li&gt;Xamarin：开发安卓等其他客户端程序&lt;/li&gt;
      &lt;li&gt;MAUI：Xamarin的升级版&lt;/li&gt;
      &lt;li&gt;Blazor：使用html开发简易的桌面应用&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Kotlin：可以编译成Java字节码，也可以编译成 JavaScript，方便在没有 JVM 的设备上运行。&lt;/li&gt;
  &lt;li&gt;Swift：是一种支持多编程范式和编译式的开源编程语言，用于开发iOS OSX和watchOS应用程序&lt;/li&gt;
  &lt;li&gt;Docker：是一个开源的应用容器引擎，打包应用以及依赖包到一个轻量级、可移植的容器中运行。
    &lt;ul&gt;
      &lt;li&gt;k8s：全称kubernetes，为容器服务而生的一个可移植容器的编排管理工具 &lt;a href=&quot;http://docs.kubernetes.org.cn/227.html&quot;&gt;链接&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Jenkins：是开源CI&amp;amp;CD软件领导者，提供持续集成和持续交付服务，有超过1000个插件来支持构建、部署、自动化，满足任何项目的需要。&lt;/li&gt;
  &lt;li&gt;Kibana：开源日志分析&lt;/li&gt;
  &lt;li&gt;Elasticsearch：全文搜索引擎数据库&lt;/li&gt;
  &lt;li&gt;Logstash：收集、解析转换和存储日志数据&lt;/li&gt;
  &lt;li&gt;Grafana：可视化和构建仪表板&lt;/li&gt;
  &lt;li&gt;Kafka：基于zookeeper协调的分布式日志系统，主要应用场景是：日志收集系统和消息系统。&lt;/li&gt;
  &lt;li&gt;RabbitMQ：消息队列处理&lt;/li&gt;
  &lt;li&gt;MyCat：数据库集群管理&lt;/li&gt;
  &lt;li&gt;Zookeeper：分布式应用程序协调服务&lt;/li&gt;
  &lt;li&gt;Keepalived：单点故障问题高可用解决方案&lt;/li&gt;
&lt;/ul&gt;

&lt;h5 id=&quot;选择合适的操作系统服务器&quot;&gt;选择合适的操作系统（服务器）&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;国外
    &lt;ul&gt;
      &lt;li&gt;Red Hat Enterprise Linux&lt;/li&gt;
      &lt;li&gt;CentOS&lt;/li&gt;
      &lt;li&gt;ubuntu&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;国内
    &lt;ul&gt;
      &lt;li&gt;桌面操作系统-深度&lt;/li&gt;
      &lt;li&gt;统一操作系统-UOS&lt;/li&gt;
      &lt;li&gt;华为-openEuler(兼容centos)&lt;/li&gt;
      &lt;li&gt;阿里-Alibaba Cloud Linux&lt;/li&gt;
      &lt;li&gt;阿里-AnolisOS(兼容centos)&lt;/li&gt;
      &lt;li&gt;腾讯-TencentOS&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Ansible简单使用</title>
   <link href="https://comeround.cn/article/ansible.html"/>
   <updated>2018-09-20T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/ansible</id>
   <content type="html">&lt;h2 id=&quot;ansible使用笔记&quot;&gt;Ansible使用笔记&lt;/h2&gt;
&lt;p&gt;（1）安装及配置&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;软件安装：只需要在管理端安装：yum install -y ansible&lt;/li&gt;
  &lt;li&gt;秘钥配置：私钥放在管理端服务器，公钥放在被管理端服务器，若有多台被管理服务器则都需放置，使ssh能直接连接&lt;/li&gt;
  &lt;li&gt;配置：把被管理端的IP放入到hosts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;（2）连接和测试&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;ansible 47.106.123.191 -m command -a ‘df -h’，运行正确则说明ansible配置完成&lt;/li&gt;
  &lt;li&gt;ping全部被管理机：ansible all -m ping&lt;/li&gt;
  &lt;li&gt;ping测试[or]组&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@xinxi-server ansible]# ansible or -m ping
47.106.123.191 | SUCCESS =&amp;gt; {
    &quot;changed&quot;: false, 
    &quot;ping&quot;: &quot;pong&quot;
}
120.79.83.150 | SUCCESS =&amp;gt; {
    &quot;changed&quot;: false, 
    &quot;ping&quot;: &quot;pong&quot;
}
118.31.62.194 | SUCCESS =&amp;gt; {
    &quot;changed&quot;: false, 
    &quot;ping&quot;: &quot;pong&quot;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;（3）远程命令模块&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;执行命令&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ansible Client -m command -a &quot;free -m&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ul&gt;
  &lt;li&gt;执行脚本&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ansible Client -m script -a &quot;/home/test.sh 12 34&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ul&gt;
  &lt;li&gt;复制文件&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ansible Client -m copy -a &quot;src=/home/test.sh dest=/tmp/ owner=root group=root mode=0755&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ul&gt;
  &lt;li&gt;获取远程文件的详细情况&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ansible 118.31.62.194 -m stat -a &quot;path=/home/test.sh&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ul&gt;
  &lt;li&gt;下载网络文件到被管理机&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ansible 118.31.62.194 -m get_url -a &quot;url=http://soft.vpser.net/lnmp/lnmp1.5.tar.gz dest=/home mode=0755 force=yes&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ul&gt;
  &lt;li&gt;控制被管理机yum安装软件（示例中为安装npm）&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ansible 118.31.62.194 -m yum -a &quot;name=npm state=latest&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ul&gt;
  &lt;li&gt;配置crontab&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ansible Client -m cron -a &quot;name=&apos;check dirs&apos; hour=&apos;5,2&apos; job=&apos;ls / &amp;gt; /home/test.txt&apos;&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;在被管理机：&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[root@iz tmp]# crontab -l
#Ansible: check dirs
* 5,2 * * * ls / &amp;gt; /home/test.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;Playbook的使用&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;---
- hosts: aliyun
  remote_user: root
  tasks:
    - name: install git
      yum: name=git state=latest
    - name: clone lnmp
      shell: &quot;cd /home;git clone https://user123:pass123@gitee.com/linzening/lnmp&quot;
    - name: install lnmp
      shell: &quot;cd /home/lnmp/;bash install.sh lnmp&quot;
    - name: install redis
      shell: &quot;cd /home/lnmp/;bash addons.sh 5&quot;
    - name: install mysql
      shell: &quot;cd /home/lnmp/tools;bash rpm_mysql8_0_12.sh&quot;
    - name: install myweb
      shell: &quot;cd /home/lnmp/tools;bash deploy_myweb.sh&quot;
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;运行：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ansible-book     xxx.yml&lt;/code&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;远程主机系统服务管理&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;参考：http://www.cnblogs.com/wangxiaoqiangs/p/5685239.html&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Date:2018-09-20于花果园&lt;/p&gt;
&lt;/blockquote&gt;
</content>
 </entry>
 
 <entry>
   <title>CDN基础实验:基于nginx+squid实现缓存功能</title>
   <link href="https://comeround.cn/article/cdn-basic-practical.html"/>
   <updated>2017-05-30T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/cdn-basic-practical</id>
   <content type="html">&lt;blockquote&gt;
  &lt;p&gt;实验要求&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;1、搭建2个web服务，使用nginx实现。&lt;/p&gt;

&lt;p&gt;1个做源站（然后域名为：www.cdntest.com），配置实现功能：提供可以访问的web服务，另1个做反向代理，接收用户的请求，配置实现功能是：代理到后端的squid。&lt;/p&gt;

&lt;p&gt;2、搭建一个squid服务，配置实现如下功能：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1）txt缓存1个月，jpg文件不缓存

2）配置回源功能，源站为后端的web服务器（nginx）
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;3.软件包及版本&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nginx版本包：tengine-10.10.1-68.el6.x86_64.rpm或nginx-1.10.2-1.el6.x86_64

squid版本包：squid-3.8.3-2.p.x86_64.rpm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;详细架构如下：&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/cdn-01.png&quot; alt=&quot;&quot; class=&quot;demo-images&quot; /&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;实验说明&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;1、squid软件一般常用于代理中，也是最常见的缓存及代理软件，它可以在Windows和Linux等系统运行&lt;/p&gt;

&lt;p&gt;2、nginx在本实验中用做http服务器和反向代理服务器，可以运行在Windows和Linux等系统运行&lt;/p&gt;

&lt;p&gt;3、小提示：nginx、squid可以使用同一主机的不同端口实现本实验。&lt;/p&gt;

&lt;p&gt;4、实现域名访问：①虚拟机环境下修改Windows全局hosts文件；②在Linux中搭建bind域名服务器。&lt;/p&gt;

&lt;p&gt;本实验以Windows的nginx作为源站，Linux的Squid作为缓存服务器、Linux的Nginx作为反向代理服务器，测试客户为以上3台的任意一台。&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;准备环境：系统和软件准备&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;系统：Windows10；Linux CentOS6.5 final；&lt;/p&gt;

&lt;p&gt;软件：nginx-1.10.2-1.el6.x86_64；squid-3.1.23-24.el6.x86_64&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;系统结构&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/cdn-02.png&quot; alt=&quot;&quot; class=&quot;demo-images&quot; /&gt;&lt;/p&gt;

&lt;p&gt;源站IP：10.9.8.1&lt;/p&gt;

&lt;p&gt;缓存代理squid IP：10.9.8.129&lt;/p&gt;

&lt;p&gt;反向代理nginx IP：10.9.8.128&lt;/p&gt;

&lt;p&gt;测试用户为以上3台主机的任意一台&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;关键配置代码&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Nginx反向代理代码：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;proxy_pass http://10.9.8.129;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Squid设置源站：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cache_peer 10.9.8.1 parent 80 0 originserver&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Squid缓存设置：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;refresh_pattern -i \.txt$ 43200 100% 43200&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;详细安装和配置&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;1源站配置windows&quot;&gt;（1）源站配置（Windows）&lt;/h3&gt;

&lt;p&gt;下载nginx的Win包安装到windows系统下，配置conf/nginx.conf如下：&lt;/p&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
&lt;span class=&quot;k&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;listen80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;www.cdntest.com&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;root&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;E:&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\\&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Nginx&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;index&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.html&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.htm&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;index.php&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;#省略部分代码&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;把txt/jpg文件放在E:\Nginx目录下&lt;/p&gt;

&lt;h3 id=&quot;2缓存服务器squid的安装及配置&quot;&gt;（2）缓存服务器Squid的安装及配置&lt;/h3&gt;

&lt;p&gt;安装：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yum install squid -y&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;配置/etc/squid/squid.conf如下：&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
http_access allow all

http_port 80 &lt;span class=&quot;c&quot;&gt;#端口一般使用常用端口&lt;/span&gt;

cache_dir ufs

/var/spool/squid 100 16 256 &lt;span class=&quot;c&quot;&gt;#缓存目录&lt;/span&gt;

http_port 10.9.8.129:80 accel vhost

cache_peer

10.9.8.1 parent 80 0 originserver &lt;span class=&quot;c&quot;&gt;#设置源站及端口&lt;/span&gt;

cache_mem 64 MB &lt;span class=&quot;c&quot;&gt;#缓存空间大小&lt;/span&gt;

acl allow_file

url_regex &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;txt&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;#允许缓存的文件&lt;/span&gt;

cache allowallow_file

refresh_pattern &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\.&lt;/span&gt;txt&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;43200100 % 43200 &lt;span class=&quot;c&quot;&gt;#设置缓存时间 单位为秒&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;3反向代理nginx的安装及配置&quot;&gt;（3）反向代理nginx的安装及配置&lt;/h3&gt;

&lt;p&gt;安装：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yum install nginx -y&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;配置：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/nginx/conf.d/default.conf&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-nginx highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
&lt;span class=&quot;k&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;www.cdntest.com&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;kn&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;

        &lt;span class=&quot;kn&quot;&gt;proxy_pass&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;http://10.9.8.129&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#反向代理地址&lt;/span&gt;

    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;配置完成后重启nginx&lt;/p&gt;

&lt;h3 id=&quot;4验证实验&quot;&gt;（4）验证实验&lt;/h3&gt;

&lt;p&gt;①通过Windows的浏览器访问&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/cdn-03.png&quot; alt=&quot;&quot; class=&quot;demo-images&quot; /&gt;&lt;/p&gt;

&lt;p&gt;②使用10.9.8.128/10.9.8.129 curl访问&lt;/p&gt;

&lt;p&gt;HTML页面&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl http://www.cdntest.com/default.html&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/cdn-04.png&quot; alt=&quot;&quot; class=&quot;demo-images&quot; /&gt;&lt;/p&gt;

&lt;p&gt;JPG图片 需要执行多次，查看是否被squid缓存&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl http://www.cdntest.com/test.jpg -I&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/cdn-05.png&quot; alt=&quot;&quot; class=&quot;demo-images&quot; /&gt;&lt;/p&gt;

&lt;p&gt;TXT文件 需要执行两次，第一次为访问源站，第二次为访问缓存&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;curl http://www.cdntest.com/test.txt -I&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/cdn-06.png&quot; alt=&quot;&quot; class=&quot;demo-images&quot; /&gt;&lt;/p&gt;

&lt;p&gt;③其他测试方法&lt;/p&gt;

&lt;p&gt;为确保缓存txt文件成功，而jpg图片不被缓存，将源站服务关掉，再次访问txt和jpg，得到以下结果：访问jpg文件服务器返回503；访问txt文件返回200&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/cdn-07.png&quot; alt=&quot;&quot; class=&quot;demo-images&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2019/cdn-08.png&quot; alt=&quot;&quot; class=&quot;demo-images&quot; /&gt;&lt;/p&gt;

&lt;p&gt;到此，已经完成了基于nginx+squid实现缓存功能的小型CDN实验&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Canvas图例学习</title>
   <link href="https://comeround.cn/article/canvas.html"/>
   <updated>2016-07-22T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/canvas</id>
   <content type="html">&lt;h2 id=&quot;1基础示例1&quot;&gt;（1）基础示例1&lt;/h2&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;!doctype html&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;meta&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;charset=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;UTF-8&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;style &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/css&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;canvas&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;dashed&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2px&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;#CCC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;$$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;pageLoad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
            &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;can&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;can&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cans&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;can&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;2d&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;gnt1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cans&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;createLinearGradient&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;390&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;gnt1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;addColorStop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#ff0000&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;gnt1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;addColorStop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.33&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#00ff00&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;gnt1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;addColorStop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.67&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#0000ff&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;gnt1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;addColorStop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#ff0000&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;cans&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fillStyle&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;gnt1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;cans&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;fillRect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;380&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;280&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;body&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;onload=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;pageLoad();&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;canvas&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;can&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;400px&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;height=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;300px&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;4&lt;span class=&quot;nt&quot;&gt;&amp;lt;/canvas&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;6画sinx的图像&quot;&gt;（6）画sinx的图像&lt;/h2&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;$$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;pageLoad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;can&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;can&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;can&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;2d&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;moveTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lineTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;600&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;480&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;moveTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lineTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;strokeStyle&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#bbb&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stroke&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//x轴&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;beginPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;moveTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;240&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lineTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1180&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;240&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;moveTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1175&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;235&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lineTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1180&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;240&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lineTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1175&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;245&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;fillText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;X&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1175&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;225&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;strokeStyle&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#f00&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;lineWidth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;moveTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;235&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lineTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;240&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;fillText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;250&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stroke&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//画曲线 sin曲线&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;beginPath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;moveTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;240&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1151&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;lineTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;220&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;sin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;  &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PI&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;240&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;strokeStyle&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;#FF0000&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;lineWidth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stroke&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;请访问http://file.fe80.cn/查看效果&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;备注：2016年7月22日于贵州财经大学制作，2022年8月15日整理到该文档&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>非线性编辑软件</title>
   <link href="https://comeround.cn/article/nonlinear-editing-soft.html"/>
   <updated>2014-06-01T00:00:00+08:00</updated>
   <id>https://comeround.cn/article/nonlinear-editing-soft</id>
   <content type="html">&lt;style type=&quot;text/css&quot;&gt;
article.post&gt;p {
    text-indent: 2em;
    margin-bottom: 10px;
}
article.post&gt;p&gt;img {
    margin: 0px auto;
}
&lt;/style&gt;

&lt;div style=&quot;background-color:rgba(197, 227, 211, 0.34);margin-bottom: 20px;&quot;&gt;
	&lt;span style=&quot;display: inline-block;
    width: 50px;
    height: 50px;
    vertical-align: top;
    overflow: hidden;
    border-radius: 0% 100px 100px 0%;
    border-width: 0px;
    border-style: none;
    border-color: rgb(62, 62, 62);
    background-color: rgb(111, 186, 131);color:#fff;
	font-weight:600;
	padding:12px;&quot;&gt;
01
	&lt;/span&gt;
	&lt;span style=&quot;color:rgb(83, 118, 105);padding:8px;display:inline-block;font-size:20px;&quot;&gt;
		非线性编辑前言
	&lt;/span&gt;
&lt;/div&gt;

&lt;p&gt;非线性视频编辑是对数字视频文件的编辑和处理，它与计算机处理其它数据文件一样，在微机的软件编辑环境中可以随时、随地、多次反复地编辑和处理。而非线性编辑系统在实际编辑过程中只是编辑点和特技效果的记录，因此任意的剪辑、修改、复制、调动画面前后顺序，都不会引起画面质量的下降，克服了传统设备的致使弱点。非线性编辑系统设备小型化，功能集成度高，与其他非线性编辑系统或普通个人计算机易于联网形成网络资源的共享。&lt;/p&gt;

&lt;p&gt;影像的非线性编辑即电子编辑，通常是指用电子手段按要求先用组合编辑将拍摄的素材按顺序编成新的连续画面。非线性的主要目标是提供对原素材任意部分的随机存取、修改和处理，从而得到新的视频影像。&lt;/p&gt;

&lt;p&gt;非线性编辑视频编辑软件是对视频（图像）源进行非线性编辑的软件，软件通过对加入的图片、背景音乐、特效、场景等素材与视频进行重混合，对视频源进行切割、合并，通过二次编码，转换成新的格式，生成具有不同表现力的新视频。&lt;/p&gt;

&lt;p&gt;随着视频应用的日益发展，视频编辑软件不断更新，功能及效果也越来越强大，家庭DV等视频应用越来越广泛，所以会简单的视频编辑技术是我们必备的计算机技术。本书简单讲诉非线性编辑中常用的视频编辑软件，便于向一些视频初学者了解和选择合适的视频编辑软件。&lt;/p&gt;

&lt;p&gt;以下是对视频编辑软件的分类和总体概述。&lt;/p&gt;

&lt;p&gt;一般来说，首先根据对操作及特效效果的要求，来选择编辑软件。&lt;/p&gt;

&lt;p&gt;从实现来看，视频编辑软件大体分为四大类：&lt;/p&gt;

&lt;p&gt;一类是玩具式的：特点是操作非常简单，没有什么更多的功能和特效，质量难以保证。这类软件有格式工厂，玩家宝宝，movie maker等。&lt;/p&gt;

&lt;p&gt;二类是业余级别的视频编辑软件：特点是有一定的功能和特效，操作相对比较简单。特效是傻瓜式的，只能进行有限的调整，质量一般，如威力导演，会声会影等。&lt;/p&gt;

&lt;p&gt;三类是半专业级别的：特点是功能相对较全，特效比较多一些，操作不太复杂，能根据编辑人员的要求实现一些特效要求。如EDIUS , Sony Vegas等。&lt;/p&gt;

&lt;p&gt;四类是专业级别的：如Premiere，After Effects。功能强大，操作复杂。&lt;/p&gt;

&lt;p&gt;如果需要更多的视频特效，需要用视频特效制作软件AE。平面及模拟三维中的特效基本上能全部实现！从玩具式–业余–半专业–专业的排序是：玩家宝宝，move maker，威力导演，会声会影，EDIUS，Vegas，Premiere，After Effects。&lt;/p&gt;

&lt;p&gt;软件越专业，功能越强大，操作也就越复杂。&lt;/p&gt;

&lt;p style=&quot;text-align: right;&quot;&gt;
2014年6月
&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;movie-maker&quot;&gt;Movie Maker&lt;/h3&gt;

&lt;p&gt;Windows Live Movie Maker是由微软开发的一款影片编辑软件。Movie Maker Live是windows vista及以上版本附带的一个影视剪辑小软件（windows xp带有Movie Maker），功能比较简单，可以组合镜头，声音，加入镜头切换的特效，只要将镜头片段拖入就行，很简单，适合家用摄像后的一些小规模的处理。通过 Windows Movie Maker Live(影音制作)，你可以简单明了地将一堆家庭视频和照片转变为感人的家庭电影、音频剪辑或商业广告。剪裁视频，添加配乐和一些照片，然后只需单击一下就可以添加主题，从而为你的电影添加匹配的过渡和片头。你制作的电影看起来是如此的专业，人们很难相信它们竟是免费的。&lt;/p&gt;

&lt;p&gt;软件大小：4.69MB 更新时间：2011-8-31&lt;/p&gt;

&lt;hr /&gt;
&lt;h3 id=&quot;wondershare-software&quot;&gt;Wondershare Software&lt;/h3&gt;

&lt;p&gt;【万兴软件】深圳万兴软件有限公司，2003年9月正式成立。&lt;/p&gt;

&lt;p&gt;2011年6月，万兴软件宣布转战移动互联网。同年12月推出拍照+录像应用 PowerCam，上线APP Store仅三个月下载量突破1000万，并先后跻身数十个国家同类软件或综合类下载冠军。未来万兴软件将基于”全盘移动化”战略，为用户呈现更多样化的产品、服务以及更完美的体验。&lt;/p&gt;

&lt;p&gt;作为 “国家级高新技术企业”、”2011年国家火炬计划重点高新技术企业”，万兴软件连续三年荣登德勤高科技高成长”亚太区500强”及”中国50强”，以及连续两年”福布斯中国最具发展潜力企业”。依靠强大的创新研发团队、全球性的营销体系及完善的产品服务，万兴软件致力通过提供更强性能，更独特用户体验的应用产品，持续驱动消费者的幸福生活！&lt;/p&gt;

&lt;p&gt;【Wondershare DVD Slideshow】Wondershare DVD Slideshow Builder Deluxe 是一个强大的 DVD 视频相册制作工具，它可以将视频剪辑、图片等资源合成为动感视频相册，并添加 2D/3D 幻灯片转场特效。Wondershare DVD Slideshow Builder Deluxe 有两种工作模式：Standard Mode 可以将将图片文件转换为 Flash 动画相册；Advanced Mode 则支持导入各类视频文件和图片文件，并合成为视频相册。&lt;/p&gt;

&lt;p&gt;数码故事 Wondershare Movie Story 最先由 DVD Slideshow Builder 升级而来，现在 Movie Story 又进一步升级为 DVD Slideshow Builder Deluxe，我感觉是整合了 Photo Story 与 Movie Story 的功能，变得非常强大且易用。&lt;/p&gt;

&lt;p&gt;2012年6月7 日更新版本为 Wondershare DVD Slideshow Builder Deluxe 6.1.10.62。&lt;/p&gt;

&lt;p&gt;下载链接地址：http://www.portablesoft.org/dvd-slideshow-builder-deluxe/   34.8 MB&lt;/p&gt;

&lt;p&gt;解压密码：www.portablesoft.org&lt;/p&gt;

&lt;p&gt;【Wondershare Movie Story(数码故事)】4.5.1.1简体中文绿色版18.9 MB&lt;/p&gt;

&lt;p&gt;下载链接地址：http://www.portablesoft.org/wondershare-movie-story/&lt;/p&gt;

&lt;p&gt;解压密码：www.portablesoft.org&lt;/p&gt;

&lt;hr /&gt;
&lt;h3 id=&quot;powerdirector&quot;&gt;PowerDirector&lt;/h3&gt;

&lt;p&gt;PowerDirector的中文名字译作威力导演，它由讯连科技（CyberLink）制作发行，是一套制作CD、DVD电影作品的完全解决方案，可让使用者进行采集、编辑、选单制作、及烧录电影作品于DVD、VCD、SVCD及MiniDVD光盘，轻松撷取影像及编辑影片，同时还拥有独特的光盘制作精灵，能快速简易地执行影片制作及烧录。&lt;/p&gt;

&lt;p&gt;威力导演是影片制作软件的新里程碑，制作专业的影片/影音光盘，任何人皆可成为创意十足的影音玩家！独特脚本区/时间轴双介面，兼具简易使用与专业精确的优点；首创DV 扫瞄功能，能够快速扫瞄整卷DV影片，截取指定片段，配合最新SVRT 2技术，全面提升影音输出处理速度！除此之外，威力导演还提供了百余种文字、转场特效及前所未见的影片特效，能让您制作出最具特色的影片及DVD光盘！
【讯连科技】讯连科技创立于1995年，拥有顶尖视讯与音讯技术的台湾影音软件公司，专精于数字影音软件及多媒体串流应用解决方案产品研发，讯连科技总经理张华祯－拥有美国UCLA企管硕士学位，曾任国际知名防毒软件公司－趋势科技执行副总经理一职，在软件行销和财务管理上有丰富的经验，其开放式的美式管理风格为讯连注入讲求创新及效率的企业文化，也带领讯连科技迈向国际舞台！ 由于讯连高度的成长，2000 年 10 月讯连科技正式于台湾 IPO 上柜，并打破承销价 188 元的记录！&lt;/p&gt;

&lt;p&gt;讯连自 1998 年起即已分别于日本、韩国、美国硅谷、欧洲成立分公司及行销据点，从此以国际行销为主要目标，并突破以往与世界信息大厂软硬件搭售（bundle）的行销模式，直接将软件触角延伸至国外，目前已直接出货的地方包括了香港、大陆、韩国、日本、新加坡、丹麦、德国、英国、意大利、加拿大及美国等地，全球销售量已占讯连科技总营业额的百分之七十！而为扩大全球行销，讯连更是透过网际网络，架构起全年零时差的产品销售服务网，是台湾少数能够在国际市场上昂首阔步的软件巨人。&lt;/p&gt;

&lt;p&gt;威力导演12（12.0.2109.0）正式版大小：514.6MB  2013年9月发行&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/video-power.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;
&lt;h3 id=&quot;final-cut-pro&quot;&gt;Final Cut Pro&lt;/h3&gt;

&lt;p&gt;Final Cut Pro 是苹果公司开发的一款专业视频非线性编辑软件，第一代Final Cut Pro在1999年推出。最新版本Final Cut Pro X 包含进行后期制作所需的一切功能。导入并组织媒体、编辑、添加效果、改善音效、颜色分级以及交付 — 所有操作都可以在该应用程序中完成。&lt;/p&gt;

&lt;p&gt;Final Cut Pro是Final Cut Studio中的一个产品，Final Cut Studio中还包括Motion livetype soundtrack等字幕、包装、声音方面的软件。所以这两个就是包含和被包含的关系。&lt;/p&gt;

&lt;p&gt;Final Cut Pro是一个非常好的软件包，它提供较佳的编辑功能，具有像Adobe After Effects高端合成程序包中的合成特性。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/video-final-cut-pro.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;
&lt;h3 id=&quot;corel-videostudio&quot;&gt;Corel VideoStudio&lt;/h3&gt;

&lt;p&gt;VideoStudio Pro（会声会影）是由Corel 公司推出的影音编辑工具，是一种比较常用的视频制作软件。Corel成立于1985年，总部设立于加拿大渥太华。&lt;/p&gt;

&lt;p&gt;会声会影是友立公司出品的一款视频处理软件，会声会影其主要的特点是：完整的影片编辑流程解决方案、从拍摄到分享、新增处理速度加倍！当然对计算机的系统和软硬件设施也有一定的要求。会声会影，不仅完全符合家庭或个人所需的影片剪辑功能，甚至可以挑战专业级的影片剪辑软件。该软件具有成批转换功能与捕获格式完整的特点。虽然无法与EDIUS，Adobe Premiere，Adobe After Effect和Sony Vegas等专业视频处理软件媲美，但会声会影一贯以简单易用、功能丰富的作风赢得了良好的口碑。在国内的普及度较高。&lt;/p&gt;

&lt;p&gt;会声会影是现在应用最广泛的视频制作软件之一，它的可视化操作页面和多变的特效被广大非专业人员应用并且制作出了高水平的视频。Corel VideoStudio现在有的版本有很多，比较常用的9,11,12，等，最新版为X7，官方未出简体中文版，但已有人制作汉化补丁。&lt;/p&gt;

&lt;p&gt;【版本号】&lt;/p&gt;

&lt;p&gt;Corel公司出品的会声会影X2版是2009新推出的一款一体化视频编辑软件，与之前的版本比较有了很大的进步，并且在功能上也更加全面和方便，会声会影X2可以用于创建高质量的高清及标清影片、相册和 DVD。可以使用影片向导快速、轻松地编辑视频或照片，或者通过动手创意工具进行全面控制。甚至可以在视频上绘画或写入内容。可以将影片刻录到 DVD、高清AVCHD™ 和 Blu-ray 光盘。
会声会影X3版本发行与2010年6月，其主要的特点是：完整的影片编辑流程解决方案：从拍摄到分享、新增处理速度加倍！现在包含完整的蓝光制作与烧录功能等，当然对计算机的系统和软硬件设施也有一定的要求。&lt;/p&gt;

&lt;p&gt;会声会影X4发布于2011年4月，不仅完全符合家庭或个人所需的影片剪辑功能，甚至可以挑战专业级的影片剪辑软件。&lt;/p&gt;

&lt;p&gt;会声会影X5于2012年3月正式推出， 2012年09月最新版的X5及其套件参加了2012年的国际互联网创意大会。2012年9月25日会声会影X5简体中文版在北京正式发布。在原有功能上，增加了屏幕录制、HTLM5支持、导入多图层图形、功能模板库、工作区可扩展性、DVD制作、下载和交换模板并获取免费教程、支持更多型号的相机、21个多媒体轨道以及更高的性能等新功能。&lt;/p&gt;

&lt;p&gt;会声会影X6专业版于2013年3月在澳大利亚的官网上发布了会声会影X6旗舰版(VideoStudio Ultimate X6)。新增功能：运动跟踪、可定制运动、DSLR 定格动画、DSLR 放大模式、超高清 (4K) 视频支持、AVCHD 2.0 支持、可变速度、屏幕捕捉、字幕编辑器、轨道切换、可定制的随机转场特效、QuickTime Alpha 通道等。正式版软件大小：1.32GB。&lt;/p&gt;

&lt;p&gt;会声会影X7于2014年2月发行，正式版软件大小1768.9 MB，旗舰版1802.3MB。对屏幕录制功能的优化，可以同时录制系统声音和麦克风的声音，而且视频格式新增了mpg、MP4、flv、avi、mov。清晰度可以自己设定，最高质量清晰度非常之高。新增了 FastFlick™易于编辑模式。加快了4K和多轨道渲染。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/video-studio.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;edius&quot;&gt;Edius&lt;/h3&gt;

&lt;p&gt;EDIUS是日本canopus(草谷)公司的优秀非线性编辑软件。&lt;/p&gt;

&lt;p&gt;EDIUS非线性编辑软件专为广播和后期制作环境而设计，特别针对新闻记者、无带化视频制播和存储。EDIUS拥有完善的基于文件工作流程，提供了实时、多轨道、多格式混编、合成、色键、字幕和时间线输出功能。除了标准的EDIUS系列格式，还支持 Infinity™ JPEG 2000、DVCPRO、P2、VariCam、Ikegami GigaFlash、MXF 、XDCAM和XDCAM EX视频素材。同时支持所有DV、HDV摄像机和录像机。
EDIUS v6.54 官方简体中文完整版 软件大小：1720.00MB；&lt;/p&gt;

&lt;p&gt;2013年8月，草谷公司发布EDIUS 7，软件大小：1.74GB包括Pro和Elite版本。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/video-edius.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;
&lt;h3 id=&quot;sony-vegas&quot;&gt;Sony Vegas&lt;/h3&gt;

&lt;p&gt;索尼Vegas(中文读作维加斯)家族共有四个系列，包括Vegas Movie Studio、Vegas Movie Studio Platinum、Vegas Movie Studio Platinum Pro Pack 和Vegas Pro 。其中前三个系列是为民用级的非线性编辑系统提供的产品解决方案，后一款Sony Vegas Pro 是为专业级别的影视制作者们准备的音视频编辑系统，可以制作编辑出更完美的视频效果．基本可以满足广大影视爱好者的需要。&lt;/p&gt;

&lt;p&gt;2014年04月17日Sony Vegas Pro 13正式推出，仅支持64位操作系统。&lt;/p&gt;

&lt;p&gt;2010年10月11日Sony Vegas Pro 10正式推出，功能更强大，加入了3d影片编辑功能,还有gpu的avc编码运算以及图像稳定功能和轨道管理等功能。&lt;/p&gt;

&lt;p&gt;在2007年9月7号的的IBC大展上，SONY创作公司会正式地公布Vegas软件的最新版本。Vegas Pro 8将会包含能够提供最优化HD剪辑的核心技术，和SONY AVCHD流水线。他同时也提升了回放的效能，加强对XDCAM工程的支持，全新的字幕技术，提升的剪辑功能，还有更多重大的更新和功能。&lt;/p&gt;

&lt;p&gt;Vegas Pro 8是面向所有专业人员的终极的多功能软件产品。他集合了Vegas Pro 8，DVD Architect Pro 4.5和Dolby Digital AC-3编码软件为一个系列的套装，提供快捷的速度，强大的功能，和最大的创作效率。无论是你需要强大的视频剪辑，精确的音频控制，或者DVD创作的工具，Vegas Pro 8都是一个完整的专业HD剪辑，音频编辑和DVD制作的产品。他包含了如下更新：&lt;/p&gt;

&lt;p&gt;Vegas Pro套装包含了 Vegas Pro 8, DVD Architect Pro 4.5, 和 Dolby Digital AC-3编码软件，为你提供专业视频，音频，DVD和广播制作的综合运用环境。这些工具可以让你实时编辑和制作DV, AVCHD, HDV, SD/HD-SDI,以及XDCAM格式，精确地调整音频，和制作环绕声道，双层DVD。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/video-vegas.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;
&lt;h3 id=&quot;premiere&quot;&gt;Premiere&lt;/h3&gt;

&lt;p&gt;Premiere即adobe premiere ，简称PR，一款常用的视频编辑软件，由Adobe公司推出。现在常用的有CS4、CS5、CS5.5 、CS6、CC等版本。是一款编辑画面质量比较好的软件，有较好的兼容性，且可以与adobe公司推出的其他软件相互协作。目前这款软件广泛应用于广告制作和电视节目制作中。 其最新版本为Adobe Premiere Pro CC。&lt;/p&gt;

&lt;p&gt;Premiere Pro是视频编辑爱好者和专业人士准备的必不可少的编辑工具。它可以提升您的创作能力和创作自由度，它是易学、高效、精确的视频剪辑软件。Premiere提供了采集、剪辑、调色、美化音频、字幕添加、输出、DVD刻录的一整套流程，并和其他Adobe软件高效集成，使您足以完成在编辑、制作、工作流上遇到的所有挑战，满足您创建高质量作品的要求。&lt;/p&gt;

&lt;p&gt;【和AE的区别】AE（After Effects）是Premiere的兄弟产品，是一套动态图形的设计工具和特效合成软件。有着比Premiere更加复杂的结构和更难的学习难度，主要应用于Motion Graphic设计、媒体包装和VFX（视觉特效）。&lt;/p&gt;

&lt;p&gt;而Premiere是一款剪视频辑软件，用于视频段落的组合和拼接，并提供一定的特效与调色功能。Premiere和AE可以通过Adobe动态链接联动工作，满足日益复杂的视频制作需求。&lt;/p&gt;

&lt;p&gt;视频的处理程序常为：先用Premiere剪辑视频，再交由Auditon处理音频，最后再用After Effects制作特效。&lt;/p&gt;

&lt;p&gt;【版本号】&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;先前版本&lt;/th&gt;
      &lt;th&gt;发行时间&lt;/th&gt;
      &lt;th&gt;备注&lt;/th&gt;
      &lt;th&gt;版本&lt;/th&gt;
      &lt;th&gt;发行时间&lt;/th&gt;
      &lt;th&gt; &lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;6.0&lt;/td&gt;
      &lt;td&gt;2002年&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;CS3&lt;/td&gt;
      &lt;td&gt;2008年&lt;/td&gt;
      &lt;td&gt;不推荐使用&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;6.5&lt;/td&gt;
      &lt;td&gt;2003年&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;CS4&lt;/td&gt;
      &lt;td&gt;2009年&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;7.0&lt;/td&gt;
      &lt;td&gt;2004年&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;CS5&lt;/td&gt;
      &lt;td&gt;2010年&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Pro1.5&lt;/td&gt;
      &lt;td&gt;2005年&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;CS5.5&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Pro2.0&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;比较稳定&lt;/td&gt;
      &lt;td&gt;CS6&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;CC&lt;/td&gt;
      &lt;td&gt;2013年6月&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/video-pr.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;
&lt;h3 id=&quot;after-effects&quot;&gt;After Effects&lt;/h3&gt;

&lt;p&gt;After Effects简称AE，是Adobe公司开发的一个视频合成及特效制作软件。After Effects 用于高端视频特效系统的专业特效合成软件，隶属美国Adobe公司。它借鉴了许多优秀软件的的成功之处，将视频特效合成上升到了新的高度：Photoshop中层的引入 ，使AE可以对多层的合成图像进行控制，制作出天衣无缝的合成效果； 关键帧、路径的引入，使我们对控制高级的二维动画游刃有余；高效的视频处理系统，确保了高质量视频的输出；令人眼花缭乱的特技系统使AE能实现使用者的一切创意；AE同样保留有Adobe优秀的软件相互兼容性。&lt;/p&gt;

&lt;p&gt;After Effects可以非常方便地调入Photoshop，Illustrator的层文件；Premiere的项目文件也可以近乎完美的再现于AE中；甚至还可以调入Premiere的EDL文件。新版本还能将二维和三维在一个合成中灵活的混合起来。用户可以在二维或者三维中工作或者混合起来并在层的基础上进行匹配。使用三维的层切换可以随时把一个层转化为三维的；二维和三维的层都可以水平或垂直移动；三维层可以在三维空间里进行动画操作，同时保持与灯光，阴影和相机的交互影响！并且AE支持大部分的音频，视频，图文格式，甚至还能将记录三维通道的文件调入进行更改。&lt;/p&gt;

&lt;p&gt;在PC的视讯应用上，由Adobe公司所研发的Premiere与After Effects等数字影片编辑产品，多年来一直是业界使用最频繁的软件，在国内也有非常多的学校系所，或是私立的计算机学院是以这两套软件相互搭配，来做为影片后制的授课内容。另一方面，许多第三协力厂商也研发专供这两项产品作为外挂（plug-ins）之用的外挂程序，使得Premiere与After Effects主程序功能更增添实用性与便利性。&lt;/p&gt;

&lt;p&gt;After Effects CS6是Adobe公司推出的影视编辑软件，其特效功能非常强大，可以高效且精确地制作出多种引人注目的动态图形和震撼人心的视觉效果。&lt;/p&gt;

&lt;p&gt;现在After Effects已经被广泛地应用于数字和电影的后期制作中，而新兴的多媒体和互联网也为After Effects软件提供了宽广的发展空间。相信在不久的将来，After Effects软件必将成为影视领域的主流软件。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/public/blog/2020/video-ae.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;以下是视频处理的常用辅助工具，常用于视频简单处理、压缩及格式转换等&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;软件名称&lt;/th&gt;
      &lt;th&gt;发行公司（商）&lt;/th&gt;
      &lt;th&gt;常用版本号&lt;/th&gt;
      &lt;th&gt;主要用途&lt;/th&gt;
      &lt;th&gt;备注&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;格式工厂&lt;/td&gt;
      &lt;td&gt;陈俊豪&lt;/td&gt;
      &lt;td&gt;3.3.4&lt;/td&gt;
      &lt;td&gt;万能多媒体格式转换&lt;/td&gt;
      &lt;td&gt;58.57ＭＢ&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;kkcapture&lt;/td&gt;
      &lt;td&gt;杭州凯凯科技&lt;/td&gt;
      &lt;td&gt;2.4.1&lt;/td&gt;
      &lt;td&gt;（游戏）高清录像&lt;/td&gt;
      &lt;td&gt;4.04MB&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Autodesk Flame&lt;/td&gt;
      &lt;td&gt;Autodesk&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;终极视觉特效&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;VirtualDubMod&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;为视频压缩人员准备&lt;/td&gt;
      &lt;td&gt;已停止更新&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
</content>
 </entry>
 

</feed>
