【发布时间】:2021-10-11 20:10:25
【问题描述】:
当用户共享商店时,我想缩短我应用中的共享 URL。我想要一种方法或 API,让我可以缩短 URL 以使其看起来干净但使用我的网站名称。
例如:
longURL:"https://example.com?x=somevalue&y=someothervalues"
然后,当我使用 API 或方法缩短 URL 时,它会生成一个类似于以下内容的小 URL:"https://mywebsite.com/shortenedURLcode"
这是我的代码:
link = URL(string: "https://mywebsitename.com/share/?shop="+concatenate(getKey!,"&title="+shopName.text!.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!,"&desc="+summary.text!.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!,"&img="+profileImgURL))
我想用我网站的主机名缩短上述链接。
我该怎么做?
【问题讨论】:
-
域名会一直保持不变,还是会根据店铺或其他因素而有所变化?
标签: ios swift api clean-urls short-url