<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ### gocaptcha 一個簡單的Go語言實現的驗證碼 ### 圖片實例 ![](https://img.kancloud.cn/95/ac/95acc74ff0a08719c4994bcb659ff520_300x100.jpg) ### 簡介 基于Golang實現的圖片驗證碼生成庫,可以實現隨機字母個數,隨機直線,隨機噪點等。可以設置任意多字體,每個驗證碼隨機選一種字體展示。 ### 實例 #### 使用: ``` go get github.com/lifei6671/gocaptcha/ ``` #### 使用的類庫 ``` go get github.com/golang/freetype go get github.com/golang/freetype/truetype go get golang.org/x/image ``` ### 代碼 具體實例可以查看example目錄,有生成的驗證碼圖片。 ```go package main import ( "fmt" "html/template" "log" "net/http" "github.com/lifei6671/gocaptcha" ) const ( dx = 150 dy = 50 ) func main() { // 加載所有字體 err := gocaptcha.ReadFonts("fonts", ".ttf") if err != nil { fmt.Println(err) return } http.HandleFunc("/", Index) http.HandleFunc("/get/", Get) fmt.Println("服務已啟動...") err = http.ListenAndServe(":8800", nil) if err != nil { log.Fatal(err) } } func Index(w http.ResponseWriter, r *http.Request) { t, err := template.ParseFiles("tpl/index.html") if err != nil { log.Fatal(err) } _ = t.Execute(w, nil) } func Get(w http.ResponseWriter, r *http.Request) { captchaImage := gocaptcha.NewCaptchaImage(dx, dy, gocaptcha.RandLightColor()) err := captchaImage.DrawNoise(gocaptcha.CaptchaComplexLower). DrawTextNoise(gocaptcha.CaptchaComplexLower). DrawText(gocaptcha.RandText(4)). DrawBorder(gocaptcha.ColorToRGB(0x17A7A7A)). DrawSineLine().Error if err != nil { fmt.Println(err) } _ = captchaImage.SaveImage(w, gocaptcha.ImageFormatJpeg) } ```
                  <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>

                              哎呀哎呀视频在线观看