<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ## 圖片驗證碼 orange 圖片驗證碼能快速生成字符類型的圖片驗證碼,通過sessioin存儲對驗證碼進行校驗。 ### 快速使用 #### 生成圖片驗證碼 - 使用前先將配置中的 session 功能開啟; - 在控制器方法中添加 ``` // 第一個參數是控制器方法中的 context // 第二個參數是生成的字符個數 一般4-6 // 第三,四個參數是圖片的寬,高,可以不填,默認尺寸是180*60 return captcha.CaptchaImgShow(c *app.Context, n int, width height int) // 一個控制器的完整例子 func Captcha(c *app.Context) error { return captcha.CaptchaImgShow(c, 4) } ``` 有的時候我們業務中可能希望能獲得生成驗證碼的具體數據進行業務處理,可以通過如下方法獲取 ~~~ // 一個控制器的完整例子 // CaptchaImgByte方法能獲取到具體的驗證碼數據和圖片 byte 數據 func CaptchaCode(c *app.Context) error { text, imgByte := captcha.CaptchaImgByte(c, 4) fmt.Println(text, imgByte) return c.ToString(text) } ~~~ #### 校驗驗證碼正確性 ~~~ // 這是一個控制器函數 func VerifyImg(c *app.Context) error { // 獲取 GET 參數中的驗證碼 code := c.Request().FormValue("code") // 校驗驗證碼的正確性,返回值是布爾類型 ret:= captcha.CaptchaVerify(c, code) return c.ToJson(map[string]interface{}{ "result": ret, }) } ~~~ 圖片驗證碼效果圖預覽 ![](https://img.kancloud.cn/58/6f/586ff08793e2e75544af6ec48c91fe5c_405x235.png)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看