urls.JoinPath
Syntax
urls.JoinPath ELEMENT...
Returns
string
{{ urls.JoinPath }} → "" (空字符串)
{{ urls.JoinPath "" }} → /
{{ urls.JoinPath "a" }} → a
{{ urls.JoinPath "a" "b" }} → a/b
{{ urls.JoinPath "/a" "b" }} → /a/b
{{ urls.JoinPath "https://example.org" "b" }} → https://example.org/b
{{ urls.JoinPath (slice "a" "b") }} → a/b
与path.Join
函数不同,urls.JoinPath
保留连续的前导斜杠。