2014年6月19日 星期四

在ASP網頁中自動產生QRCode

function qrCode(strText,intSize)
    if strText = "this" then
        strProtocol = "http"
        strHTTPS = lcase(request.ServerVariables("HTTPS")
        if strHTTPS <> "off" then strProtocol = "https"
        strDomain = Request.ServerVariables("SERVER_NAME")
        strURL = Request.ServerVariables("SCRIPT_NAME")
        strQueryString = Request.ServerVariables("QUERY_STRING")
        strText = strProtocol & "://" & strDomain & strURL & "?" & strQueryString
    end if

    qrCode = "https://chart.googleapis.com/chart?cht=qr&chs=" & intSize & "x" & intSize & "&chld=L|1&chl=" & server.URLEncode(strText)

end function


所以只要下以下命令即可:
        qrCode("this",150)

詳細資料請參閱:https://developers.google.com/chart/infographics/docs/qr_codes