如何使用 PHP 将 ID 插入到字符串中?

How to insert an ID into a string with PHP?

我为 Drupal 8.6 创建了一个模块。我有一个变量 $store_id 和商店的 id

如何将 $store_id 插入以下 link:

Url::fromUri('internal:/store/?????/cgv', $attributes)

例如当 $store_id = 6 我想得到:

internal:/store/6/cgv 作为 Url::fromUri

的参数

根据 Nick 的评论,只需将其更改为:

Url::fromUri("internal:/store/$store_id/cgv", $attributes)