额,忘了几个地方
前端html 增加
<script src='https://www.google.com/recaptcha/api.js'></script>
后端golang部分
type JSONAPIResponse struct {
Success bool `json:"success"`
ChallengeTS time.Time `json:"challenge_ts"` // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)
Hostname string `json:"hostname"` // the hostname of the site where the reCAPTCHA was solved
ErrorCodes []int `json:"error-codes"` //optional
}
增加
json.Unmarshal(body, &APIResp)
fmt.Println(APIResp)
增加判断APIResp.Success 是true还是false 的代码就可以了