作者热门文章
- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
在下面example , URL 的结尾 /
被删除了,有没有办法保留 /
?
package main
import (
"fmt"
"net/url"
"path"
)
func main() {
u, _ := url.Parse("http://localhost:5100")
relative, _ := url.Parse(path.Join("hello/"))
fmt.Println(u.ResolveReference(relative))
}
输出:
http://localhost:5100/hello
最佳答案
我想出了答案,那就是不使用path.Join
:
package main
import (
"fmt"
"net/url"
)
func main() {
u, _ := url.Parse("http://localhost:5100")
relative, _ := url.Parse("hello/")
fmt.Println(u.ResolveReference(relative))
}
输出:
http://localhost:5100/hello/
关于http - Go中的ResolveReference时如何避免删除URL斜杠的结尾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23051339/
我正在尝试通过 NAnt/MSBuild 调用发布一个 ASP.Net 网站。使用以下参数调用 MSBuild: 当我在巡航控制下尝试构建时,出现以下错误: error MSB4057
我构建了一个网络爬虫,它可以在网站上搜索该页面上的所有链接,然后获取该链接并在其中搜索更多链接,直到爬取整个页面。在我遇到一个特殊的站点之前一直运行良好。 链接问题: 正常情况 1:绝对路径如 ' h
我是一名优秀的程序员,十分优秀!