如何使用变量创建合适的 iframe

How to create a proper iframe with a variable

我正在尝试为 Youtube 嵌入视频创建标签,其中 src 来自数据库的变量值

标签是这样的:

<iframe class="img-fluid w-100" width="560" height="315" src="https://www.youtube.com/embed/videoseries?list=PLx0sYbCqOb8TBPRdmBHs5Iftvv9TPboYG" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

我正在尝试这样替换它:

<iframe class="img-fluid w-100" width="560" height="315" src="{{frontPageConfig.recentVideos2.linkURL}}"
            frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

但是不管有没有{{variable}}它都不起作用。

谢谢。

您可能需要像

中那样清理 URL

尽管您会发现版本存在一些问题: