🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# UrlSegments `Get|Set Dictionary` >[danger] 要添加Url Segments,使用[`AddUrlSegment`](AddUrlSegment.md) Url Segments用于轻松向`Resource`添加动态值。 使用大括号在`Resource`中创建Url Segment,然后使用`AddUrlSegment`替换为动态值。 ``` Dim Request As New WebRequest Dim User As String Dim Id As Long User = "Tim" Id = 123 '// OK: Use string concatenation for dynamic values Request.Resource = User & "/messages/" & Id '// BETTER: Use Url Segments for dynamic values Request.Resource = "{User}/messages/{Id}" Request.AddUrlSegment "User", User Request.AddUrlSegment "Id", Id Request.FormattedResource '// = "Tim/messages/123" ```