You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
549 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package main
import (
"encoding/base64"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
// 如果要用在url中需要使用URLEncoding
input:="C:\\Users\\Administrator\\Desktop\\技术讨论会\\20A4782A-512C-40ED-8AF9-FCFC7CD29E5B.docx"
uEnc := base64.URLEncoding.EncodeToString([]byte(input))
fmt.Println(uEnc)
//生成预览OFFICE的服务地址
url := "http://10.10.24.100:9000/support/preview/preview"
resp, _ := http.Get(url+"?p="+uEnc)
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}