企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 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" ```