qr_code.go 282 B

12345678910111213141516
  1. package services
  2. import (
  3. "fmt"
  4. "github.com/skip2/go-qrcode"
  5. "log"
  6. )
  7. func GetQRCode() {
  8. err := qrcode.WriteFile("https://www.baidu.com", qrcode.Medium, 256, "./static/qrcode.png")
  9. if err != nil {
  10. log.Fatal(err)
  11. }
  12. log.Println("二维码生成成功")
  13. fmt.Println("ok")
  14. }