我有一個YouTube視頻嵌入代碼,看起來像這樣:如何在PHP中執行此REGEX?
<iframe width="560" height="315" src="http://www.youtube.com/embed/XGdfNb15h9o" frameborder="0" allowfullscreen></iframe>
我需要添加以下(它擺脫的相關視頻建議):
?rel=0
的每個網址的結尾在嵌入代碼中。所以在上面的例子中,最終的代碼應該是這樣的:
<iframe width="560" height="315" src="http://www.youtube.com/embed/XGdfNb15h9o?rel=0" frameborder="0" allowfullscreen></iframe>
的嵌入代碼被存儲在一個名爲$embed_code
變量。我如何將嵌入代碼轉換爲適用於它的?rel=0
?
工程。輸出是板條貓的視頻...大聲笑 – xbonez