代码:
```
url := "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+appid+"&secret="+secret
fmt.Println(url)
```
appid和secret字符串打印结果正常。
输出结果:
![image.png](https://static.studygolang.com/190428/9fe5cd57e2c23169297dc7b025ac4859.png)
1楼 <a href="/user/polaris" title="@polaris">@polaris</a>
```
appid := env1.Get("APPID")
fmt.Printf("type of appid is %T, len of appid is %d\n", appid, len(appid))
secret := env1.Get("SECRET")
fmt.Printf("type of secret is %T, len of secret is %d\n", secret, len(secret))
url := `https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=`+appid+`&secret=`+secret
fmt.Println(url)
```
![image.png](https://static.studygolang.com/190428/a10761391b688f6f78bbc3acef6d8bd4.png)
#3
更多评论
```
appid := env1.Get("APPID")
fmt.Printf("type of appid is %T, len of appid is %d\n", appid, len(appid))
secret := env1.Get("SECRET")
fmt.Printf("type of secret is %T, len of secret is %d\n", secret, len(secret))
url := `https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=`+appid+`&secret=`+secret
fmt.Println(url)
```
![image.png](https://static.studygolang.com/190428/a10761391b688f6f78bbc3acef6d8bd4.png)
#2