Yapi结合swagger备注自动生成接口文档

TP5适用

例项目名称tp5

文件public下下载swagger-ui(只需要dist下的文件)

git clone https://github.com/swagger-api/swagger-ui.git

然后打开下载好的文件夹,找到dist目录, 打开index.html把其中的那一串url改成自己的url,就是第一步中的创建好的那个url,记得后面加上swagger.json,即http://localhost/tp5/swagger-ui/swagger.json

<script>
window.onload = function() {
  // Build a system
  const ui = SwaggerUIBundle({
    url: "http://localhost/tpSwagger/tp5/swaggerApi/swagger.json", // 更改此url为你的url
    dom_id: '#swagger-ui',
    presets: [
      SwaggerUIBundle.presets.apis,
      SwaggerUIStandalonePreset
    ],
    plugins: [
      SwaggerUIBundle.plugins.DownloadUrl
    ],
    layout: "StandaloneLayout"
  })
 
  window.ui = ui
}
</script>

改完之后,访问下你的swagger-ui中index所在的url:http://localhost/tp5/swagger-ui/index.html,显示的内容应该为:Failed to load spec.

安装swagger-php后端(第三方类)

进入

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值