doc: update docs/fastapi.md 2b6b58d7fb

This commit is contained in:
jaywcjlove
2024-04-07 18:41:06 +00:00
parent 78edefa825
commit 0c775a1cb3
4 changed files with 61 additions and 35 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
<title>FastAPI 备忘清单 <title>FastAPI 备忘清单
&#x26; fastapi cheatsheet &#x26; Quick Reference</title> &#x26; fastapi cheatsheet &#x26; Quick Reference</title>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta description="FastAPI 是一个用于构建 API 的现代、快速(高性能)的 web 框架,使用 Python 3.6+ 并基于标准的 Python 类型提示。Python: 3.9.5 FastAPI: 0.103.1 <meta description="一个用于构建 API 的现代、快速(高性能)的 web 框架,使用 Python 3.6+ 并基于标准的 Python 类型提示
入门,为开发人员分享快速参考备忘单。"> 入门,为开发人员分享快速参考备忘单。">
<meta keywords="fastapi,reference,Quick,Reference,cheatsheet,cheat,sheet"> <meta keywords="fastapi,reference,Quick,Reference,cheatsheet,cheat,sheet">
@ -30,12 +30,26 @@
<path d="M12 0C5.375 0 0 5.375 0 12c0 6.627 5.375 12 12 12 6.626 0 12-5.373 12-12 0-6.625-5.373-12-12-12zm-.624 21.62v-7.528H7.19L13.203 2.38v7.528h4.029L11.376 21.62z"></path> <path d="M12 0C5.375 0 0 5.375 0 12c0 6.627 5.375 12 12 12 6.626 0 12-5.373 12-12 0-6.625-5.373-12-12-12zm-.624 21.62v-7.528H7.19L13.203 2.38v7.528h4.029L11.376 21.62z"></path>
</svg> </svg>
<a aria-hidden="true" tabindex="-1" href="#fastapi-备忘清单"><span class="icon icon-link"></span></a>FastAPI 备忘清单</h1><div class="wrap-body"> <a aria-hidden="true" tabindex="-1" href="#fastapi-备忘清单"><span class="icon icon-link"></span></a>FastAPI 备忘清单</h1><div class="wrap-body">
<p>FastAPI 是一个用于构建 API 的现代、快速(高性能)的 web 框架,使用 Python 3.6+ 并基于标准的 Python 类型提示。Python: <code>3.9.5</code> FastAPI: <code>0.103.1</code></p> <p>一个用于构建 API 的现代、快速(高性能)的 web 框架,使用 Python 3.6+ 并基于标准的 Python 类型提示</p>
</div></header><div class="menu-tocs"><div class="menu-btn"><svg aria-hidden="true" fill="currentColor" height="1em" width="1em" viewBox="0 0 16 16" version="1.1" data-view-component="true"> </div></header><div class="menu-tocs"><div class="menu-btn"><svg aria-hidden="true" fill="currentColor" height="1em" width="1em" viewBox="0 0 16 16" version="1.1" data-view-component="true">
<path fill-rule="evenodd" d="M2 4a1 1 0 100-2 1 1 0 000 2zm3.75-1.5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zM3 8a1 1 0 11-2 0 1 1 0 012 0zm-1 6a1 1 0 100-2 1 1 0 000 2z"></path> <path fill-rule="evenodd" d="M2 4a1 1 0 100-2 1 1 0 000 2zm3.75-1.5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zM3 8a1 1 0 11-2 0 1 1 0 012 0zm-1 6a1 1 0 100-2 1 1 0 000 2z"></path>
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#入门">入门</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#最小程序">最小程序</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#路径参数">路径参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#最基本的路径参数">最基本的路径参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#多个路径参数">多个路径参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#有类型的路径参数">有类型的路径参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#文件路径参数">文件路径参数</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#查询参数">查询参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#带默认值的查询参数">带默认值的查询参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#可选查询参数">可选查询参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#多路径多查询参数">多路径多查询参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#必需查询参数">必需查询参数</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#请求体">请求体</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#调用">调用</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#查询参数和字符串校验">查询参数和字符串校验</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#参数列表">参数列表</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#多个相同的查询参数">多个相同的查询参数</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#路径参数和数值校验">路径参数和数值校验</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#导入-path">导入 Path</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#声明元数据">声明元数据</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#参数列表-1">参数列表</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#其他参数">其他参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#cookie参数">Cookie参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#header-参数">Header 参数</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#表单数据">表单数据</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#安装">安装</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#html">HTML</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#fastapi">FastAPI</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#文件上传">文件上传</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#uploadfile属性">UploadFile属性</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#uploadfile-async方法">UploadFile async方法</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#依赖项">依赖项</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#依赖项使用场景">依赖项使用场景</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#创建依赖项">创建依赖项</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#类作为依赖项">类作为依赖项</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#还可以简写">还可以简写</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#子依赖项">子依赖项</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#不使用缓存">不使用缓存</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#全局依赖项">全局依赖项</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#安全性">安全性</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#参考">参考</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="入门"><a aria-hidden="true" tabindex="-1" href="#入门"><span class="icon icon-link"></span></a>入门</h2><div class="wrap-body"> </svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#入门">入门</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#安装-fastapi">安装 FastAPI</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#可以分开来安装">可以分开来安装</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#运行代码">运行代码</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#最小程序">最小程序</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#路径参数">路径参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#最基本的路径参数">最基本的路径参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#多个路径参数">多个路径参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#有类型的路径参数">有类型的路径参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#文件路径参数">文件路径参数</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#查询参数">查询参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#带默认值的查询参数">带默认值的查询参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#可选查询参数">可选查询参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#多路径多查询参数">多路径多查询参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#必需查询参数">必需查询参数</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#请求体">请求体</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#调用">调用</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#查询参数和字符串校验">查询参数和字符串校验</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#参数列表">参数列表</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#多个相同的查询参数">多个相同的查询参数</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#路径参数和数值校验">路径参数和数值校验</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#导入-path">导入 Path</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#声明元数据">声明元数据</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#参数列表-1">参数列表</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#其他参数">其他参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#cookie参数">Cookie参数</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#header-参数">Header 参数</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#表单数据">表单数据</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#安装">安装</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#html">HTML</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#fastapi">FastAPI</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#文件上传">文件上传</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#uploadfile-属性">UploadFile 属性</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#uploadfile-async-方法">UploadFile async 方法</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#依赖项">依赖项</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#依赖项使用场景">依赖项使用场景</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#创建依赖项">创建依赖项</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#类作为依赖项">类作为依赖项</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#还可以简写">还可以简写</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#子依赖项">子依赖项</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#不使用缓存">不使用缓存</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#全局依赖项">全局依赖项</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#安全性">安全性</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#参考">参考</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="入门"><a aria-hidden="true" tabindex="-1" href="#入门"><span class="icon icon-link"></span></a>入门</h2><div class="wrap-body">
<!--rehype:body-class=cols-2--> <!--rehype:body-class=cols-2-->
</div></div><div class="h2wrap-body cols-2"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="最小程序"><a aria-hidden="true" tabindex="-1" href="#最小程序"><span class="icon icon-link"></span></a>最小程序</h3><div class="wrap-body"> </div></div><div class="h2wrap-body cols-2"><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="安装-fastapi"><a aria-hidden="true" tabindex="-1" href="#安装-fastapi"><span class="icon icon-link"></span></a>安装 FastAPI</h3><div class="wrap-body">
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ pip <span class="token function">install</span> <span class="token string">"fastapi[all]"</span>
</span></code></pre>
<h4 id="可以分开来安装"><a aria-hidden="true" tabindex="-1" href="#可以分开来安装"><span class="icon icon-link"></span></a>可以分开来安装</h4>
<p>假如你想将应用程序部署到生产环境,你可能要执行以下操作:</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ pip <span class="token function">install</span> fastapi
</span></code></pre>
<p>并且安装 <code>uvicorn</code> 来作为服务器:</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ pip <span class="token function">install</span> <span class="token string">"uvicorn[standard]"</span>
</span></code></pre>
<h4 id="运行代码"><a aria-hidden="true" tabindex="-1" href="#运行代码"><span class="icon icon-link"></span></a>运行代码</h4>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ uvicorn main:app <span class="token parameter variable">--reload</span>
</span></code></pre>
<p>Python: <code>3.9.5</code> FastAPI: <code>0.103.1</code></p>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="最小程序"><a aria-hidden="true" tabindex="-1" href="#最小程序"><span class="icon icon-link"></span></a>最小程序</h3><div class="wrap-body">
<p>下面代码会直接启动http服务也可以使用 <code>uvicorn main:app --reload</code></p> <p>下面代码会直接启动http服务也可以使用 <code>uvicorn main:app --reload</code></p>
<pre class="language-python"><code class="language-python code-highlight"><span class="code-line"><span class="token keyword">from</span> fastapi <span class="token keyword">import</span> FastAPI <pre class="language-python"><code class="language-python code-highlight"><span class="code-line"><span class="token keyword">from</span> fastapi <span class="token keyword">import</span> FastAPI
</span><span class="code-line"><span class="token keyword">import</span> uvicorn </span><span class="code-line"><span class="token keyword">import</span> uvicorn
@ -126,11 +140,13 @@
</div></div></div><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="请求体"><a aria-hidden="true" tabindex="-1" href="#请求体"><span class="icon icon-link"></span></a>请求体</h3><div class="wrap-body"> </div></div></div><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="请求体"><a aria-hidden="true" tabindex="-1" href="#请求体"><span class="icon icon-link"></span></a>请求体</h3><div class="wrap-body">
<pre class="language-python"><code class="language-python code-highlight"><span class="code-line"><span class="token keyword">from</span> pydantic <span class="token keyword">import</span> BaseModel <pre class="language-python"><code class="language-python code-highlight"><span class="code-line"><span class="token keyword">from</span> pydantic <span class="token keyword">import</span> BaseModel
</span><span class="code-line"><span class="token keyword">from</span> typing <span class="token keyword">import</span> Union </span><span class="code-line"><span class="token keyword">from</span> typing <span class="token keyword">import</span> Union
</span><span class="code-line">
</span><span class="code-line"><span class="token keyword">class</span> <span class="token class-name">Item</span><span class="token punctuation">(</span>BaseModel<span class="token punctuation">)</span><span class="token punctuation">:</span> </span><span class="code-line"><span class="token keyword">class</span> <span class="token class-name">Item</span><span class="token punctuation">(</span>BaseModel<span class="token punctuation">)</span><span class="token punctuation">:</span>
</span><span class="code-line"> name<span class="token punctuation">:</span> <span class="token builtin">str</span> <span class="token operator">=</span> <span class="token string">'小明'</span> </span><span class="code-line"> name<span class="token punctuation">:</span> <span class="token builtin">str</span> <span class="token operator">=</span> <span class="token string">'小明'</span>
</span><span class="code-line"> description<span class="token punctuation">:</span> Union<span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> <span class="token boolean">None</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token boolean">None</span> </span><span class="code-line"> description<span class="token punctuation">:</span> Union<span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> <span class="token boolean">None</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token boolean">None</span>
</span><span class="code-line"> price<span class="token punctuation">:</span> <span class="token builtin">float</span> </span><span class="code-line"> price<span class="token punctuation">:</span> <span class="token builtin">float</span>
</span><span class="code-line"> tax<span class="token punctuation">:</span> Union<span class="token punctuation">[</span><span class="token builtin">float</span><span class="token punctuation">,</span> <span class="token boolean">None</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token boolean">None</span> </span><span class="code-line"> tax<span class="token punctuation">:</span> Union<span class="token punctuation">[</span><span class="token builtin">float</span><span class="token punctuation">,</span> <span class="token boolean">None</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token boolean">None</span>
</span><span class="code-line">
</span><span class="code-line"><span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>post</span><span class="token punctuation">(</span><span class="token string">"/items/"</span><span class="token punctuation">)</span> </span><span class="code-line"><span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>post</span><span class="token punctuation">(</span><span class="token string">"/items/"</span><span class="token punctuation">)</span>
</span><span class="code-line"><span class="token keyword">async</span> <span class="token keyword">def</span> <span class="token function">create_item</span><span class="token punctuation">(</span>item<span class="token punctuation">:</span> Item<span class="token punctuation">)</span><span class="token punctuation">:</span> </span><span class="code-line"><span class="token keyword">async</span> <span class="token keyword">def</span> <span class="token function">create_item</span><span class="token punctuation">(</span>item<span class="token punctuation">:</span> Item<span class="token punctuation">)</span><span class="token punctuation">:</span>
</span><span class="code-line"> <span class="token keyword">print</span><span class="token punctuation">(</span>item<span class="token punctuation">.</span>name<span class="token punctuation">)</span> </span><span class="code-line"> <span class="token keyword">print</span><span class="token punctuation">(</span>item<span class="token punctuation">.</span>name<span class="token punctuation">)</span>
@ -150,6 +166,7 @@
</span></code></pre> </span></code></pre>
</div></div></div><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="查询参数和字符串校验"><a aria-hidden="true" tabindex="-1" href="#查询参数和字符串校验"><span class="icon icon-link"></span></a>查询参数和字符串校验</h3><div class="wrap-body"> </div></div></div><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="查询参数和字符串校验"><a aria-hidden="true" tabindex="-1" href="#查询参数和字符串校验"><span class="icon icon-link"></span></a>查询参数和字符串校验</h3><div class="wrap-body">
<pre class="language-python"><code class="language-python code-highlight"><span class="code-line"><span class="token keyword">from</span> fastapi <span class="token keyword">import</span> Query <pre class="language-python"><code class="language-python code-highlight"><span class="code-line"><span class="token keyword">from</span> fastapi <span class="token keyword">import</span> Query
</span><span class="code-line">
</span><span class="code-line"><span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>get</span><span class="token punctuation">(</span><span class="token string">"/items/"</span><span class="token punctuation">)</span> </span><span class="code-line"><span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>get</span><span class="token punctuation">(</span><span class="token string">"/items/"</span><span class="token punctuation">)</span>
</span><span class="code-line"><span class="token keyword">async</span> <span class="token keyword">def</span> <span class="token function">read_items</span><span class="token punctuation">(</span> </span><span class="code-line"><span class="token keyword">async</span> <span class="token keyword">def</span> <span class="token function">read_items</span><span class="token punctuation">(</span>
</span><span class="code-line"> q<span class="token punctuation">:</span> Union<span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> <span class="token boolean">None</span><span class="token punctuation">]</span> <span class="token operator">=</span> Query<span class="token punctuation">(</span>default<span class="token operator">=</span><span class="token boolean">None</span><span class="token punctuation">,</span> max_length<span class="token operator">=</span><span class="token number">50</span><span class="token punctuation">)</span> </span><span class="code-line"> q<span class="token punctuation">:</span> Union<span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> <span class="token boolean">None</span><span class="token punctuation">]</span> <span class="token operator">=</span> Query<span class="token punctuation">(</span>default<span class="token operator">=</span><span class="token boolean">None</span><span class="token punctuation">,</span> max_length<span class="token operator">=</span><span class="token number">50</span><span class="token punctuation">)</span>
@ -200,7 +217,7 @@
<table><thead><tr><th>参数</th><th>含义</th><th>类型</th></tr></thead><tbody><tr><td>default</td><td>默认值</td><td>任意类型或...</td></tr><tr><td>max_length</td><td>最大长度</td><td>int</td></tr><tr><td>min_length</td><td>最小长度</td><td>int</td></tr><tr><td>pattern</td><td>正则匹配</td><td>string</td></tr><tr><td>alias</td><td>别名参数</td><td>string</td></tr><tr><td>deprecated</td><td>准备弃用参数</td><td>bool</td></tr></tbody></table> <table><thead><tr><th>参数</th><th>含义</th><th>类型</th></tr></thead><tbody><tr><td><code>default</code></td><td>默认值</td><td>任意类型或...</td></tr><tr><td><code>max_length</code></td><td>最大长度</td><td><code>int</code></td></tr><tr><td><code>min_length</code></td><td>最小长度</td><td><code>int</code></td></tr><tr><td><code>pattern</code></td><td>正则匹配</td><td><code>string</code></td></tr><tr><td><code>alias</code></td><td>别名参数</td><td><code>string</code></td></tr><tr><td><code>deprecated</code></td><td>准备弃用参数</td><td><code>bool</code></td></tr></tbody></table>
<h4 id="多个相同的查询参数"><a aria-hidden="true" tabindex="-1" href="#多个相同的查询参数"><span class="icon icon-link"></span></a>多个相同的查询参数</h4> <h4 id="多个相同的查询参数"><a aria-hidden="true" tabindex="-1" href="#多个相同的查询参数"><span class="icon icon-link"></span></a>多个相同的查询参数</h4>
<pre class="language-python"><code class="language-python code-highlight"><span class="code-line"><span class="token comment"># http://127.0.0.1:8000/items/?q=foo&#x26;q=bar</span> <pre class="language-python"><code class="language-python code-highlight"><span class="code-line"><span class="token comment"># http://127.0.0.1:8000/items/?q=foo&#x26;q=bar</span>
</span><span class="code-line"><span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>get</span><span class="token punctuation">(</span><span class="token string">"/items/"</span><span class="token punctuation">)</span> </span><span class="code-line"><span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>get</span><span class="token punctuation">(</span><span class="token string">"/items/"</span><span class="token punctuation">)</span>
@ -268,11 +285,12 @@
<table><thead><tr><th>参数</th><th>含义</th><th>类型</th></tr></thead><tbody><tr><td>...</td><td>和Query具有相同参数</td><td>...</td></tr><tr><td>ge</td><td>大于等于</td><td>int float</td></tr><tr><td>gt</td><td>大于</td><td>int float</td></tr><tr><td>le</td><td>小于等于</td><td>int float</td></tr><tr><td>le</td><td>小于等于</td><td>int float</td></tr><tr><td>title</td><td>api文档的标题</td><td>string</td></tr></tbody></table> <table><thead><tr><th>参数</th><th>含义</th><th>类型</th></tr></thead><tbody><tr><td><code>...</code></td><td> Query 具有相同参数</td><td>...</td></tr><tr><td><code>ge</code></td><td>大于等于</td><td><code>int float</code></td></tr><tr><td><code>gt</code></td><td>大于</td><td><code>int float</code></td></tr><tr><td><code>le</code></td><td>小于等于</td><td><code>int float</code></td></tr><tr><td><code>le</code></td><td>小于等于</td><td><code>int float</code></td></tr><tr><td><code>title</code></td><td>api文档的标题</td><td><code>string</code></td></tr></tbody></table>
</div></div></div><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="其他参数"><a aria-hidden="true" tabindex="-1" href="#其他参数"><span class="icon icon-link"></span></a>其他参数</h3><div class="wrap-body"> </div></div></div><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="其他参数"><a aria-hidden="true" tabindex="-1" href="#其他参数"><span class="icon icon-link"></span></a>其他参数</h3><div class="wrap-body">
<p>都具有 Query 的参数max_length、min_length</p> <p>都具有 <code>Query</code> 的参数,<code>max_length</code><code>min_length</code> </p>
<h4 id="cookie参数"><a aria-hidden="true" tabindex="-1" href="#cookie参数"><span class="icon icon-link"></span></a>Cookie参数</h4> <h4 id="cookie参数"><a aria-hidden="true" tabindex="-1" href="#cookie参数"><span class="icon icon-link"></span></a>Cookie参数</h4>
<pre class="language-python"><code class="language-python code-highlight"><span class="code-line"><span class="token keyword">from</span> fastapi <span class="token keyword">import</span> Cookie <pre class="language-python"><code class="language-python code-highlight"><span class="code-line"><span class="token keyword">from</span> fastapi <span class="token keyword">import</span> Cookie
</span><span class="code-line">
</span><span class="code-line"><span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>get</span><span class="token punctuation">(</span><span class="token string">"/items/"</span><span class="token punctuation">)</span> </span><span class="code-line"><span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>get</span><span class="token punctuation">(</span><span class="token string">"/items/"</span><span class="token punctuation">)</span>
</span><span class="code-line"><span class="token keyword">async</span> <span class="token keyword">def</span> <span class="token function">read_items</span><span class="token punctuation">(</span> </span><span class="code-line"><span class="token keyword">async</span> <span class="token keyword">def</span> <span class="token function">read_items</span><span class="token punctuation">(</span>
</span><span class="code-line"> ads_id<span class="token punctuation">:</span> Annotated<span class="token punctuation">[</span>Union<span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> <span class="token boolean">None</span><span class="token punctuation">]</span><span class="token punctuation">,</span> Cookie<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token boolean">None</span> </span><span class="code-line"> ads_id<span class="token punctuation">:</span> Annotated<span class="token punctuation">[</span>Union<span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> <span class="token boolean">None</span><span class="token punctuation">]</span><span class="token punctuation">,</span> Cookie<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token boolean">None</span>
@ -281,6 +299,7 @@
</span></code></pre> </span></code></pre>
<h4 id="header-参数"><a aria-hidden="true" tabindex="-1" href="#header-参数"><span class="icon icon-link"></span></a>Header 参数</h4> <h4 id="header-参数"><a aria-hidden="true" tabindex="-1" href="#header-参数"><span class="icon icon-link"></span></a>Header 参数</h4>
<pre class="language-python"><code class="language-python code-highlight"><span class="code-line"><span class="token keyword">from</span> fastapi <span class="token keyword">import</span> Header <pre class="language-python"><code class="language-python code-highlight"><span class="code-line"><span class="token keyword">from</span> fastapi <span class="token keyword">import</span> Header
</span><span class="code-line">
</span><span class="code-line"><span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>get</span><span class="token punctuation">(</span><span class="token string">"/items/"</span><span class="token punctuation">)</span> </span><span class="code-line"><span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>get</span><span class="token punctuation">(</span><span class="token string">"/items/"</span><span class="token punctuation">)</span>
</span><span class="code-line"><span class="token keyword">async</span> <span class="token keyword">def</span> <span class="token function">read_items</span><span class="token punctuation">(</span> </span><span class="code-line"><span class="token keyword">async</span> <span class="token keyword">def</span> <span class="token function">read_items</span><span class="token punctuation">(</span>
</span><span class="code-line"> user_agent<span class="token punctuation">:</span> Annotated<span class="token punctuation">[</span>Union<span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> <span class="token boolean">None</span><span class="token punctuation">]</span><span class="token punctuation">,</span> Header<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token boolean">None</span><span class="token punctuation">,</span> </span><span class="code-line"> user_agent<span class="token punctuation">:</span> Annotated<span class="token punctuation">[</span>Union<span class="token punctuation">[</span><span class="token builtin">str</span><span class="token punctuation">,</span> <span class="token boolean">None</span><span class="token punctuation">]</span><span class="token punctuation">,</span> Header<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token boolean">None</span><span class="token punctuation">,</span>
@ -291,7 +310,8 @@
</div></div></div><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="表单数据"><a aria-hidden="true" tabindex="-1" href="#表单数据"><span class="icon icon-link"></span></a>表单数据</h3><div class="wrap-body"> </div></div></div><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="表单数据"><a aria-hidden="true" tabindex="-1" href="#表单数据"><span class="icon icon-link"></span></a>表单数据</h3><div class="wrap-body">
<p>接收的不是 JSON而是表单字段时要使用 Form。</p> <p>接收的不是 JSON而是表单字段时要使用 Form。</p>
<h4 id="安装"><a aria-hidden="true" tabindex="-1" href="#安装"><span class="icon icon-link"></span></a>安装</h4> <h4 id="安装"><a aria-hidden="true" tabindex="-1" href="#安装"><span class="icon icon-link"></span></a>安装</h4>
<p><code>pip install python-multipart</code></p> <pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line">$ pip <span class="token function">install</span> python-multipart
</span></code></pre>
<h4 id="html"><a aria-hidden="true" tabindex="-1" href="#html"><span class="icon icon-link"></span></a>HTML</h4> <h4 id="html"><a aria-hidden="true" tabindex="-1" href="#html"><span class="icon icon-link"></span></a>HTML</h4>
<pre class="language-html"><code class="language-html code-highlight"><span class="code-line"><span class="token doctype"><span class="token punctuation">&#x3C;!</span><span class="token doctype-tag">DOCTYPE</span> <span class="token name">html</span><span class="token punctuation">></span></span> <pre class="language-html"><code class="language-html code-highlight"><span class="code-line"><span class="token doctype"><span class="token punctuation">&#x3C;!</span><span class="token doctype-tag">DOCTYPE</span> <span class="token name">html</span><span class="token punctuation">></span></span>
</span><span class="code-line"><span class="token tag"><span class="token tag"><span class="token punctuation">&#x3C;</span>html</span> <span class="token attr-name">lang</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>en<span class="token punctuation">"</span></span><span class="token punctuation">></span></span> </span><span class="code-line"><span class="token tag"><span class="token tag"><span class="token punctuation">&#x3C;</span>html</span> <span class="token attr-name">lang</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>en<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
@ -319,13 +339,16 @@
</span><span class="code-line"><span class="token keyword">if</span> __name__ <span class="token operator">==</span> <span class="token string">'__main__'</span><span class="token punctuation">:</span> </span><span class="code-line"><span class="token keyword">if</span> __name__ <span class="token operator">==</span> <span class="token string">'__main__'</span><span class="token punctuation">:</span>
</span><span class="code-line"> uvicorn<span class="token punctuation">.</span>run<span class="token punctuation">(</span>app<span class="token operator">=</span><span class="token string">'main:app'</span><span class="token punctuation">,</span> <span class="token builtin">reload</span><span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">)</span> </span><span class="code-line"> uvicorn<span class="token punctuation">.</span>run<span class="token punctuation">(</span>app<span class="token operator">=</span><span class="token string">'main:app'</span><span class="token punctuation">,</span> <span class="token builtin">reload</span><span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">)</span>
</span></code></pre> </span></code></pre>
</div></div></div><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="文件上传"><a aria-hidden="true" tabindex="-1" href="#文件上传"><span class="icon icon-link"></span></a>文件上传</h3><div class="wrap-body"> </div></div></div><div class="wrap h3body-exist col-span-2"><div class="wrap-header h3wrap"><h3 id="文件上传"><a aria-hidden="true" tabindex="-1" href="#文件上传"><span class="icon icon-link"></span></a>文件上传</h3><div class="wrap-body">
<!--rehype:wrap-class=col-span-2-->
<pre class="language-python"><code class="language-python code-highlight"><span class="code-line"><span class="token keyword">from</span> fastapi <span class="token keyword">import</span> FastAPI<span class="token punctuation">,</span> UploadFile <pre class="language-python"><code class="language-python code-highlight"><span class="code-line"><span class="token keyword">from</span> fastapi <span class="token keyword">import</span> FastAPI<span class="token punctuation">,</span> UploadFile
</span><span class="code-line"><span class="token keyword">from</span> fastapi<span class="token punctuation">.</span>responses <span class="token keyword">import</span> HTMLResponse </span><span class="code-line"><span class="token keyword">from</span> fastapi<span class="token punctuation">.</span>responses <span class="token keyword">import</span> HTMLResponse
</span><span class="code-line">
</span><span class="code-line"><span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>post</span><span class="token punctuation">(</span><span class="token string">"/uploadfile/"</span><span class="token punctuation">)</span> </span><span class="code-line"><span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>post</span><span class="token punctuation">(</span><span class="token string">"/uploadfile/"</span><span class="token punctuation">)</span>
</span><span class="code-line"><span class="token keyword">async</span> <span class="token keyword">def</span> <span class="token function">create_upload_file</span><span class="token punctuation">(</span><span class="token builtin">file</span><span class="token punctuation">:</span> UploadFile<span class="token punctuation">)</span><span class="token punctuation">:</span> </span><span class="code-line"><span class="token keyword">async</span> <span class="token keyword">def</span> <span class="token function">create_upload_file</span><span class="token punctuation">(</span><span class="token builtin">file</span><span class="token punctuation">:</span> UploadFile<span class="token punctuation">)</span><span class="token punctuation">:</span>
</span><span class="code-line"> <span class="token keyword">print</span><span class="token punctuation">(</span><span class="token builtin">file</span><span class="token punctuation">.</span><span class="token builtin">file</span><span class="token punctuation">.</span>read<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>decode<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span> </span><span class="code-line"> <span class="token keyword">print</span><span class="token punctuation">(</span><span class="token builtin">file</span><span class="token punctuation">.</span><span class="token builtin">file</span><span class="token punctuation">.</span>read<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>decode<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
</span><span class="code-line"> <span class="token keyword">return</span> <span class="token punctuation">{</span><span class="token string">"filenames"</span><span class="token punctuation">:</span> <span class="token builtin">file</span><span class="token punctuation">.</span>filename<span class="token punctuation">,</span> <span class="token string">"type"</span><span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">(</span><span class="token builtin">type</span><span class="token punctuation">(</span><span class="token builtin">file</span><span class="token punctuation">.</span><span class="token builtin">file</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">}</span> </span><span class="code-line"> <span class="token keyword">return</span> <span class="token punctuation">{</span><span class="token string">"filenames"</span><span class="token punctuation">:</span> <span class="token builtin">file</span><span class="token punctuation">.</span>filename<span class="token punctuation">,</span> <span class="token string">"type"</span><span class="token punctuation">:</span> <span class="token builtin">str</span><span class="token punctuation">(</span><span class="token builtin">type</span><span class="token punctuation">(</span><span class="token builtin">file</span><span class="token punctuation">.</span><span class="token builtin">file</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">}</span>
</span><span class="code-line">
</span><span class="code-line"><span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>get</span><span class="token punctuation">(</span><span class="token string">"/"</span><span class="token punctuation">)</span> </span><span class="code-line"><span class="token decorator annotation punctuation">@app<span class="token punctuation">.</span>get</span><span class="token punctuation">(</span><span class="token string">"/"</span><span class="token punctuation">)</span>
</span><span class="code-line"><span class="token keyword">async</span> <span class="token keyword">def</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> </span><span class="code-line"><span class="token keyword">async</span> <span class="token keyword">def</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
</span><span class="code-line"> content <span class="token operator">=</span> <span class="token triple-quoted-string string">"""&#x3C;body> </span><span class="code-line"> content <span class="token operator">=</span> <span class="token triple-quoted-string string">"""&#x3C;body>
@ -336,7 +359,7 @@
</span></span><span class="code-line"><span class="token triple-quoted-string string">&#x3C;/body>"""</span> </span></span><span class="code-line"><span class="token triple-quoted-string string">&#x3C;/body>"""</span>
</span><span class="code-line"> <span class="token keyword">return</span> HTMLResponse<span class="token punctuation">(</span>content<span class="token operator">=</span>content<span class="token punctuation">)</span> </span><span class="code-line"> <span class="token keyword">return</span> HTMLResponse<span class="token punctuation">(</span>content<span class="token operator">=</span>content<span class="token punctuation">)</span>
</span></code></pre> </span></code></pre>
<h4 id="uploadfile属性"><a aria-hidden="true" tabindex="-1" href="#uploadfile属性"><span class="icon icon-link"></span></a>UploadFile属性</h4> <h4 id="uploadfile-属性"><a aria-hidden="true" tabindex="-1" href="#uploadfile-属性"><span class="icon icon-link"></span></a>UploadFile 属性</h4>
@ -362,8 +385,9 @@
<table><thead><tr><th>属性名</th><th>含义</th><th>返回</th></tr></thead><tbody><tr><td>filename</td><td>文件名</td><td>上传的文件名</td></tr><tr><td>content_type</td><td>内容类型</td><td>MIME 类型</td></tr><tr><td>file</td><td>文件</td><td>SpooledTemporaryFile具有readwrite方法</td></tr></tbody></table> <table class="left-align"><thead><tr><th>属性名</th><th>含义</th><th>返回</th></tr></thead><tbody><tr><td><code>filename</code></td><td>文件名</td><td>上传的文件名</td></tr><tr><td><code>content_type</code></td><td>内容类型</td><td><code>MIME</code> 类型</td></tr><tr><td><code>file</code></td><td>文件</td><td>SpooledTemporaryFile 具有 <code>read</code><code>write</code> 方法</td></tr></tbody></table>
<h4 id="uploadfile-async方法"><a aria-hidden="true" tabindex="-1" href="#uploadfile-async方法"><span class="icon icon-link"></span></a>UploadFile async方法</h4> <!--rehype:className=left-align-->
<h4 id="uploadfile-async-方法"><a aria-hidden="true" tabindex="-1" href="#uploadfile-async-方法"><span class="icon icon-link"></span></a>UploadFile async 方法</h4>
@ -389,7 +413,8 @@
<table><thead><tr><th>方法名</th><th>含义</th></tr></thead><tbody><tr><td>write(data)</td><td><code>data</code> 写入文件</td></tr><tr><td>read(size)</td><td>按指定数量的字节读取文件内容</td></tr><tr><td>seek(offset)</td><td>移动至文件 <code>offset</code> <code>int</code>)字节处的位置</td></tr><tr><td>close()</td><td>关闭文件</td></tr></tbody></table> <table class="left-align"><thead><tr><th>方法名</th><th>含义</th></tr></thead><tbody><tr><td><code>write(data)</code></td><td><code>data</code> 写入文件</td></tr><tr><td><code>read(size)</code></td><td>按指定数量的字节读取文件内容</td></tr><tr><td><code>seek(offset)</code></td><td>移动至文件 <code>offset</code> <code>int</code>)字节处的位置</td></tr><tr><td><code>close()</code></td><td>关闭文件</td></tr></tbody></table>
<!--rehype:className=left-align-->
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="依赖项"><a aria-hidden="true" tabindex="-1" href="#依赖项"><span class="icon icon-link"></span></a>依赖项</h2><div class="wrap-body"> </div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="依赖项"><a aria-hidden="true" tabindex="-1" href="#依赖项"><span class="icon icon-link"></span></a>依赖项</h2><div class="wrap-body">
<!--rehype:body-class=cols-2--> <!--rehype:body-class=cols-2-->
</div></div><div class="h2wrap-body cols-2"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="依赖项使用场景"><a aria-hidden="true" tabindex="-1" href="#依赖项使用场景"><span class="icon icon-link"></span></a>依赖项使用场景</h3><div class="wrap-body"> </div></div><div class="h2wrap-body cols-2"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="依赖项使用场景"><a aria-hidden="true" tabindex="-1" href="#依赖项使用场景"><span class="icon icon-link"></span></a>依赖项使用场景</h3><div class="wrap-body">

View File

@ -883,28 +883,28 @@
<a href="https://github.com/ryanhex53" title="ryanhex53"><img src="https://avatars.githubusercontent.com/u/360426?v=4" width="42;" alt="ryanhex53"></a> <a href="https://github.com/ryanhex53" title="ryanhex53"><img src="https://avatars.githubusercontent.com/u/360426?v=4" width="42;" alt="ryanhex53"></a>
<a href="https://github.com/partoneplay" title="partoneplay"><img src="https://avatars.githubusercontent.com/u/5189132?v=4" width="42;" alt="partoneplay"></a> <a href="https://github.com/partoneplay" title="partoneplay"><img src="https://avatars.githubusercontent.com/u/5189132?v=4" width="42;" alt="partoneplay"></a>
<a href="https://github.com/pangxiaoli" title="pangxiaoli"><img src="https://avatars.githubusercontent.com/u/54620953?v=4" width="42;" alt="pangxiaoli"></a> <a href="https://github.com/pangxiaoli" title="pangxiaoli"><img src="https://avatars.githubusercontent.com/u/54620953?v=4" width="42;" alt="pangxiaoli"></a>
<a href="https://github.com/webeautiful" title="Albert"><img src="https://avatars.githubusercontent.com/u/3364316?v=4" width="42;" alt="Albert"></a>
<a href="https://github.com/dadatom" title="Da Da"><img src="https://avatars.githubusercontent.com/u/33886943?v=4" width="42;" alt="Da Da"></a>
<a href="https://github.com/ljq" title="Jack Liu"><img src="https://avatars.githubusercontent.com/u/7278286?v=4" width="42;" alt="Jack Liu"></a>
<a href="https://github.com/Jovins" title="Jovins"><img src="https://avatars.githubusercontent.com/u/17738992?v=4" width="42;" alt="Jovins"></a>
<a href="https://github.com/LesterChang0987" title="LesterChang0987"><img src="https://avatars.githubusercontent.com/u/114913921?v=4" width="42;" alt="LesterChang0987"></a>
<a href="https://github.com/mancuoj" title="mancuoj"><img src="https://avatars.githubusercontent.com/u/45707684?v=4" width="42;" alt="mancuoj"></a> <a href="https://github.com/mancuoj" title="mancuoj"><img src="https://avatars.githubusercontent.com/u/45707684?v=4" width="42;" alt="mancuoj"></a>
<a href="https://github.com/1834423612" title="kjch"><img src="https://avatars.githubusercontent.com/u/49981661?v=4" width="42;" alt="kjch"></a> <a href="https://github.com/1834423612" title="kjch"><img src="https://avatars.githubusercontent.com/u/49981661?v=4" width="42;" alt="kjch"></a>
<a href="https://github.com/XYZscratcher" title="XYZ"><img src="https://avatars.githubusercontent.com/u/108533817?v=4" width="42;" alt="XYZ"></a>
<a href="https://github.com/greyhao" title="greyhao"><img src="https://avatars.githubusercontent.com/u/107107440?v=4" width="42;" alt="greyhao"></a> <a href="https://github.com/greyhao" title="greyhao"><img src="https://avatars.githubusercontent.com/u/107107440?v=4" width="42;" alt="greyhao"></a>
<a href="https://github.com/findnr" title="findnr"><img src="https://avatars.githubusercontent.com/u/3909023?v=4" width="42;" alt="findnr"></a> <a href="https://github.com/findnr" title="findnr"><img src="https://avatars.githubusercontent.com/u/3909023?v=4" width="42;" alt="findnr"></a>
<a href="https://github.com/genius-kim" title="Kim同学"><img src="https://avatars.githubusercontent.com/u/119488561?v=4" width="42;" alt="Kim同学"></a> <a href="https://github.com/XYZscratcher" title="XYZ"><img src="https://avatars.githubusercontent.com/u/108533817?v=4" width="42;" alt="XYZ"></a>
<a href="https://github.com/kdxcxs" title="kdxcxs"><img src="https://avatars.githubusercontent.com/u/18746192?v=4" width="42;" alt="kdxcxs"></a> <a href="https://github.com/LesterChang0987" title="LesterChang0987"><img src="https://avatars.githubusercontent.com/u/114913921?v=4" width="42;" alt="LesterChang0987"></a>
<a href="https://github.com/k983551019" title="k983551019"><img src="https://avatars.githubusercontent.com/u/48147837?v=4" width="42;" alt="k983551019"></a> <a href="https://github.com/Jovins" title="Jovins"><img src="https://avatars.githubusercontent.com/u/17738992?v=4" width="42;" alt="Jovins"></a>
<a href="https://github.com/jussker" title="jussker"><img src="https://avatars.githubusercontent.com/u/33953356?v=4" width="42;" alt="jussker"></a> <a href="https://github.com/ljq" title="Jack Liu"><img src="https://avatars.githubusercontent.com/u/7278286?v=4" width="42;" alt="Jack Liu"></a>
<a href="https://github.com/joyfully-W" title="joyfully-W"><img src="https://avatars.githubusercontent.com/u/32212924?v=4" width="42;" alt="joyfully-W"></a> <a href="https://github.com/dadatom" title="Da Da"><img src="https://avatars.githubusercontent.com/u/33886943?v=4" width="42;" alt="Da Da"></a>
<a href="https://github.com/auroraslot" title="Tang Weize"><img src="https://avatars.githubusercontent.com/u/48817882?v=4" width="42;" alt="Tang Weize"></a> <a href="https://github.com/webeautiful" title="Albert"><img src="https://avatars.githubusercontent.com/u/3364316?v=4" width="42;" alt="Albert"></a>
<a href="https://github.com/infanx" title="infanx"><img src="https://avatars.githubusercontent.com/u/65985757?v=4" width="42;" alt="infanx"></a>
<a href="https://github.com/hweining" title="hweining"><img src="https://avatars.githubusercontent.com/u/8973985?v=4" width="42;" alt="hweining"></a>
<a href="https://github.com/yanxuplay" title="hupilan"><img src="https://avatars.githubusercontent.com/u/69749541?v=4" width="42;" alt="hupilan"></a>
<a href="https://github.com/hua03" title="hua03"><img src="https://avatars.githubusercontent.com/u/19561959?v=4" width="42;" alt="hua03"></a>
<a href="https://github.com/gzttcydxx" title="gzttcydxx"><img src="https://avatars.githubusercontent.com/u/50025185?v=4" width="42;" alt="gzttcydxx"></a>
<a href="https://github.com/sunny0826" title="Xudong Guo"><img src="https://avatars.githubusercontent.com/u/24563928?v=4" width="42;" alt="Xudong Guo"></a> <a href="https://github.com/sunny0826" title="Xudong Guo"><img src="https://avatars.githubusercontent.com/u/24563928?v=4" width="42;" alt="Xudong Guo"></a>
<a href="https://github.com/gzttcydxx" title="gzttcydxx"><img src="https://avatars.githubusercontent.com/u/50025185?v=4" width="42;" alt="gzttcydxx"></a>
<a href="https://github.com/hua03" title="hua03"><img src="https://avatars.githubusercontent.com/u/19561959?v=4" width="42;" alt="hua03"></a>
<a href="https://github.com/yanxuplay" title="hupilan"><img src="https://avatars.githubusercontent.com/u/69749541?v=4" width="42;" alt="hupilan"></a>
<a href="https://github.com/hweining" title="hweining"><img src="https://avatars.githubusercontent.com/u/8973985?v=4" width="42;" alt="hweining"></a>
<a href="https://github.com/infanx" title="infanx"><img src="https://avatars.githubusercontent.com/u/65985757?v=4" width="42;" alt="infanx"></a>
<a href="https://github.com/auroraslot" title="Tang Weize"><img src="https://avatars.githubusercontent.com/u/48817882?v=4" width="42;" alt="Tang Weize"></a>
<a href="https://github.com/joyfully-W" title="joyfully-W"><img src="https://avatars.githubusercontent.com/u/32212924?v=4" width="42;" alt="joyfully-W"></a>
<a href="https://github.com/jussker" title="jussker"><img src="https://avatars.githubusercontent.com/u/33953356?v=4" width="42;" alt="jussker"></a>
<a href="https://github.com/k983551019" title="k983551019"><img src="https://avatars.githubusercontent.com/u/48147837?v=4" width="42;" alt="k983551019"></a>
<a href="https://github.com/kdxcxs" title="kdxcxs"><img src="https://avatars.githubusercontent.com/u/18746192?v=4" width="42;" alt="kdxcxs"></a>
<a href="https://github.com/Zeng-qh" title="都一样"><img src="https://avatars.githubusercontent.com/u/40046415?v=4" width="42;" alt="都一样"></a>
<a href="https://github.com/nodjoy" title="gowshwah"><img src="https://avatars.githubusercontent.com/u/145280043?v=4" width="42;" alt="gowshwah"></a> <a href="https://github.com/nodjoy" title="gowshwah"><img src="https://avatars.githubusercontent.com/u/145280043?v=4" width="42;" alt="gowshwah"></a>
<a href="https://github.com/godotc" title="godot42"><img src="https://avatars.githubusercontent.com/u/79260851?v=4" width="42;" alt="godot42"></a> <a href="https://github.com/godotc" title="godot42"><img src="https://avatars.githubusercontent.com/u/79260851?v=4" width="42;" alt="godot42"></a>
<a href="https://github.com/gi-b716" title="gi-b716"><img src="https://avatars.githubusercontent.com/u/78394473?v=4" width="42;" alt="gi-b716"></a> <a href="https://github.com/gi-b716" title="gi-b716"><img src="https://avatars.githubusercontent.com/u/78394473?v=4" width="42;" alt="gi-b716"></a>
@ -917,7 +917,7 @@
<a href="https://github.com/Lmmmmmm-bb" title="_lmmmmmm"><img src="https://avatars.githubusercontent.com/u/54026110?v=4" width="42;" alt="_lmmmmmm"></a> <a href="https://github.com/Lmmmmmm-bb" title="_lmmmmmm"><img src="https://avatars.githubusercontent.com/u/54026110?v=4" width="42;" alt="_lmmmmmm"></a>
<a href="https://github.com/y52y" title="Zyj"><img src="https://avatars.githubusercontent.com/u/51304324?v=4" width="42;" alt="Zyj"></a> <a href="https://github.com/y52y" title="Zyj"><img src="https://avatars.githubusercontent.com/u/51304324?v=4" width="42;" alt="Zyj"></a>
<a href="https://github.com/Leaderzhangyi" title="ZinkCas"><img src="https://avatars.githubusercontent.com/u/46915666?v=4" width="42;" alt="ZinkCas"></a> <a href="https://github.com/Leaderzhangyi" title="ZinkCas"><img src="https://avatars.githubusercontent.com/u/46915666?v=4" width="42;" alt="ZinkCas"></a>
<a href="https://github.com/Zeng-qh" title="都一样"><img src="https://avatars.githubusercontent.com/u/40046415?v=4" width="42;" alt="都一样"></a> <a href="https://github.com/zhu0629" title="zhucong"><img src="https://avatars.githubusercontent.com/u/13188450?v=4" width="42;" alt="zhucong"></a>
<a href="https://github.com/binscor" title="Zheng Nai Bin"><img src="https://avatars.githubusercontent.com/u/37325821?v=4" width="42;" alt="Zheng Nai Bin"></a> <a href="https://github.com/binscor" title="Zheng Nai Bin"><img src="https://avatars.githubusercontent.com/u/37325821?v=4" width="42;" alt="Zheng Nai Bin"></a>
<a href="https://github.com/qwxingzhe" title="行者"><img src="https://avatars.githubusercontent.com/u/7071651?v=4" width="42;" alt="行者"></a> <a href="https://github.com/qwxingzhe" title="行者"><img src="https://avatars.githubusercontent.com/u/7071651?v=4" width="42;" alt="行者"></a>
<a href="https://github.com/HanaChan233" title="花开花落"><img src="https://avatars.githubusercontent.com/u/75212820?v=4" width="42;" alt="花开花落"></a> <a href="https://github.com/HanaChan233" title="花开花落"><img src="https://avatars.githubusercontent.com/u/75212820?v=4" width="42;" alt="花开花落"></a>
@ -941,6 +941,7 @@
<a href="https://github.com/liliangrong777" title="liliangrong777"><img src="https://avatars.githubusercontent.com/u/58727146?v=4" width="42;" alt="liliangrong777"></a> <a href="https://github.com/liliangrong777" title="liliangrong777"><img src="https://avatars.githubusercontent.com/u/58727146?v=4" width="42;" alt="liliangrong777"></a>
<a href="https://github.com/larry-xue" title="larry"><img src="https://avatars.githubusercontent.com/u/48818060?v=4" width="42;" alt="larry"></a> <a href="https://github.com/larry-xue" title="larry"><img src="https://avatars.githubusercontent.com/u/48818060?v=4" width="42;" alt="larry"></a>
<a href="https://github.com/kubeme" title="kubernetes for me"><img src="https://avatars.githubusercontent.com/u/16346220?v=4" width="42;" alt="kubernetes for me"></a> <a href="https://github.com/kubeme" title="kubernetes for me"><img src="https://avatars.githubusercontent.com/u/16346220?v=4" width="42;" alt="kubernetes for me"></a>
<a href="https://github.com/genius-kim" title="Kim同学"><img src="https://avatars.githubusercontent.com/u/119488561?v=4" width="42;" alt="Kim同学"></a>
<a href="https://github.com/likeshop-github" title="LikeShop技术社区"><img src="https://avatars.githubusercontent.com/u/77180968?v=4" width="42;" alt="LikeShop技术社区"></a> <a href="https://github.com/likeshop-github" title="LikeShop技术社区"><img src="https://avatars.githubusercontent.com/u/77180968?v=4" width="42;" alt="LikeShop技术社区"></a>
<a href="https://github.com/Lihuagreek" title="Lihuagreek"><img src="https://avatars.githubusercontent.com/u/51040740?v=4" width="42;" alt="Lihuagreek"></a> <a href="https://github.com/Lihuagreek" title="Lihuagreek"><img src="https://avatars.githubusercontent.com/u/51040740?v=4" width="42;" alt="Lihuagreek"></a>
<a href="https://github.com/LightQuanta" title="Light_Quanta"><img src="https://avatars.githubusercontent.com/u/18213217?v=4" width="42;" alt="Light_Quanta"></a> <a href="https://github.com/LightQuanta" title="Light_Quanta"><img src="https://avatars.githubusercontent.com/u/18213217?v=4" width="42;" alt="Light_Quanta"></a>
@ -965,7 +966,6 @@
<a href="https://github.com/BlacAmDK" title="BlacAmDK"><img src="https://avatars.githubusercontent.com/u/10971397?v=4" width="42;" alt="BlacAmDK"></a> <a href="https://github.com/BlacAmDK" title="BlacAmDK"><img src="https://avatars.githubusercontent.com/u/10971397?v=4" width="42;" alt="BlacAmDK"></a>
<a href="https://github.com/dousha0w0" title="dousha0w0"><img src="https://avatars.githubusercontent.com/u/52566311?v=4" width="42;" alt="dousha0w0"></a> <a href="https://github.com/dousha0w0" title="dousha0w0"><img src="https://avatars.githubusercontent.com/u/52566311?v=4" width="42;" alt="dousha0w0"></a>
<a href="https://github.com/13812700839" title="花殇"><img src="https://avatars.githubusercontent.com/u/58072506?v=4" width="42;" alt="花殇"></a> <a href="https://github.com/13812700839" title="花殇"><img src="https://avatars.githubusercontent.com/u/58072506?v=4" width="42;" alt="花殇"></a>
<a href="https://github.com/zhu0629" title="zhucong"><img src="https://avatars.githubusercontent.com/u/13188450?v=4" width="42;" alt="zhucong"></a>
<a href="https://github.com/yikuaibro" title="yikuaibro"><img src="https://avatars.githubusercontent.com/u/44493045?v=4" width="42;" alt="yikuaibro"></a> <a href="https://github.com/yikuaibro" title="yikuaibro"><img src="https://avatars.githubusercontent.com/u/44493045?v=4" width="42;" alt="yikuaibro"></a>
<a href="https://github.com/dfshizhiqiang" title="Zech"><img src="https://avatars.githubusercontent.com/u/7030019?v=4" width="42;" alt="Zech"></a> <a href="https://github.com/dfshizhiqiang" title="Zech"><img src="https://avatars.githubusercontent.com/u/7030019?v=4" width="42;" alt="Zech"></a>
<a href="https://github.com/Yo-gurts" title="Yogurt"><img src="https://avatars.githubusercontent.com/u/44612841?v=4" width="42;" alt="Yogurt"></a> <a href="https://github.com/Yo-gurts" title="Yogurt"><img src="https://avatars.githubusercontent.com/u/44612841?v=4" width="42;" alt="Yogurt"></a>
@ -976,6 +976,7 @@
<a href="https://github.com/YLee9527" title="Terry Young"><img src="https://avatars.githubusercontent.com/u/18697332?v=4" width="42;" alt="Terry Young"></a> <a href="https://github.com/YLee9527" title="Terry Young"><img src="https://avatars.githubusercontent.com/u/18697332?v=4" width="42;" alt="Terry Young"></a>
<a href="https://github.com/TRDSCSH" title="TRDSCSH"><img src="https://avatars.githubusercontent.com/u/125717891?v=4" width="42;" alt="TRDSCSH"></a> <a href="https://github.com/TRDSCSH" title="TRDSCSH"><img src="https://avatars.githubusercontent.com/u/125717891?v=4" width="42;" alt="TRDSCSH"></a>
<a href="https://github.com/Xiwin" title="Xiwin"><img src="https://avatars.githubusercontent.com/u/107191230?v=4" width="42;" alt="Xiwin"></a> <a href="https://github.com/Xiwin" title="Xiwin"><img src="https://avatars.githubusercontent.com/u/107191230?v=4" width="42;" alt="Xiwin"></a>
<a href="https://github.com/DataEraserC" title="Sacabambaspis"><img src="https://avatars.githubusercontent.com/u/102341238?v=4" width="42;" alt="Sacabambaspis"></a>
<a href="https://github.com/qinxiongzhou" title="Ryan Zhou"><img src="https://avatars.githubusercontent.com/u/33239096?v=4" width="42;" alt="Ryan Zhou"></a> <a href="https://github.com/qinxiongzhou" title="Ryan Zhou"><img src="https://avatars.githubusercontent.com/u/33239096?v=4" width="42;" alt="Ryan Zhou"></a>
<a href="https://github.com/RivailleF" title="RivailleF"><img src="https://avatars.githubusercontent.com/u/93083015?v=4" width="42;" alt="RivailleF"></a> <a href="https://github.com/RivailleF" title="RivailleF"><img src="https://avatars.githubusercontent.com/u/93083015?v=4" width="42;" alt="RivailleF"></a>
<a href="https://github.com/QDelta" title="QDelta"><img src="https://avatars.githubusercontent.com/u/60222316?v=4" width="42;" alt="QDelta"></a> <a href="https://github.com/QDelta" title="QDelta"><img src="https://avatars.githubusercontent.com/u/60222316?v=4" width="42;" alt="QDelta"></a>
@ -1333,7 +1334,7 @@
<!--rehype:class=home-card home-links--> <!--rehype:class=home-card home-links-->
<p>如果你有资源,可以很方便<a href="https://github.com/jaywcjlove/reference/issues/102#issue-1451649637">部署 web 版</a>,这非常简单,只需要克隆 <a href="https://github.com/jaywcjlove/reference/tree/gh-pages">gh-pages</a> 分支代码到你的静态服务就可以了,还可以使用 <a href="https://hub.docker.com/r/wcjiang/reference">docker</a> 快捷部署 web 版。</p> <p>如果你有资源,可以很方便<a href="https://github.com/jaywcjlove/reference/issues/102#issue-1451649637">部署 web 版</a>,这非常简单,只需要克隆 <a href="https://github.com/jaywcjlove/reference/tree/gh-pages">gh-pages</a> 分支代码到你的静态服务就可以了,还可以使用 <a href="https://hub.docker.com/r/wcjiang/reference">docker</a> 快捷部署 web 版。</p>
</div></div><div class="h2wrap-body"></div></div></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 <a href="https://wangchujiang.com/#/app" target="_blank">Kenny Wang</a>. Updated on 2024/04/08 02:28:52</footer></footer><script src="data.js?v=1.5.3" defer></script><script src="js/fuse.min.js?v=1.5.3" defer></script><script src="js/main.js?v=1.5.3" defer></script><div id="mysearch"><div class="mysearch-box"><div class="mysearch-input"><div><svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 18 18"> </div></div><div class="h2wrap-body"></div></div></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 <a href="https://wangchujiang.com/#/app" target="_blank">Kenny Wang</a>. Updated on 2024/04/08 02:40:30</footer></footer><script src="data.js?v=1.5.3" defer></script><script src="js/fuse.min.js?v=1.5.3" defer></script><script src="js/main.js?v=1.5.3" defer></script><div id="mysearch"><div class="mysearch-box"><div class="mysearch-input"><div><svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 18 18">
<path fill="currentColor" d="M17.71,16.29 L14.31,12.9 C15.4069846,11.5024547 16.0022094,9.77665502 16,8 C16,3.581722 12.418278,0 8,0 C3.581722,0 0,3.581722 0,8 C0,12.418278 3.581722,16 8,16 C9.77665502,16.0022094 11.5024547,15.4069846 12.9,14.31 L16.29,17.71 C16.4777666,17.8993127 16.7333625,18.0057983 17,18.0057983 C17.2666375,18.0057983 17.5222334,17.8993127 17.71,17.71 C17.8993127,17.5222334 18.0057983,17.2666375 18.0057983,17 C18.0057983,16.7333625 17.8993127,16.4777666 17.71,16.29 Z M2,8 C2,4.6862915 4.6862915,2 8,2 C11.3137085,2 14,4.6862915 14,8 C14,11.3137085 11.3137085,14 8,14 C4.6862915,14 2,11.3137085 2,8 Z"></path> <path fill="currentColor" d="M17.71,16.29 L14.31,12.9 C15.4069846,11.5024547 16.0022094,9.77665502 16,8 C16,3.581722 12.418278,0 8,0 C3.581722,0 0,3.581722 0,8 C0,12.418278 3.581722,16 8,16 C9.77665502,16.0022094 11.5024547,15.4069846 12.9,14.31 L16.29,17.71 C16.4777666,17.8993127 16.7333625,18.0057983 17,18.0057983 C17.2666375,18.0057983 17.5222334,17.8993127 17.71,17.71 C17.8993127,17.5222334 18.0057983,17.2666375 18.0057983,17 C18.0057983,16.7333625 17.8993127,16.4777666 17.71,16.29 Z M2,8 C2,4.6862915 4.6862915,2 8,2 C11.3137085,2 14,4.6862915 14,8 C14,11.3137085 11.3137085,14 8,14 C4.6862915,14 2,11.3137085 2,8 Z"></path>
</svg><input id="mysearch-input" type="search" placeholder="搜索" autocomplete="off"><div class="mysearch-clear"></div></div><button id="mysearch-close" type="button">搜索</button></div><div class="mysearch-result"><div id="mysearch-menu"></div><div id="mysearch-content"></div></div></div></div></body> </svg><input id="mysearch-input" type="search" placeholder="搜索" autocomplete="off"><div class="mysearch-clear"></div></div><button id="mysearch-close" type="button">搜索</button></div><div class="mysearch-result"><div id="mysearch-menu"></div><div id="mysearch-content"></div></div></div></div></body>
</html> </html>