我知道這段代碼需要在 API 中發送 JSON 而不是表單資料
err := ctx.ShouldBindJSON(&modelAdd)
if err != nil {
return err
}
但是我需要添加檔案,除了 FormData 之外,有沒有像 ShouldBindJSON 這樣的東西?
uj5u.com熱心網友回復:
如檔案所述,您可以使用ShouldBind從表單資料中獲取資料
https://github.com/gin-gonic/gin#model-binding-and-validation
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/474148.html
