## Swagger-ui配置
> 去swagger-ui官網下載靜態頁面,把靜態頁面放到thinkphp框架目錄里,例如public目錄。
>
官網地址:[https://swagger.io/tools/swagger-ui/](https://swagger.io/tools/swagger-ui/)
> 找到swagger-ui下的dist/index.html
```
window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
//url:"http://www.tp.com.cn/swagger.json", //單文檔地址
urls:[{url:"http://www.tp.com.cn/swagger.json",name:"前端文檔"},{url:"http://www.tp.com.cn/swagger-1.json",name:"后端文檔"}], //開啟Topbar插件支持多個文檔
dom_id: '#swagger-ui',
deepLinking: false,
validatorUrl: null, //關閉驗證規則
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
```
> 打開瀏覽器訪問
[http://www.tp.com.cn/swagger-ui/dist/index.html]()
更多配置參數訪問:
[https://github.com/swagger-api/swagger-ui/blob/v3.18.3/docs/usage/configuration.md](https://github.com/swagger-api/swagger-ui/blob/v3.18.3/docs/usage/configuration.md)