如何獲取youtube和vimeo視頻嵌入代碼的視頻ID? YouTube視頻嵌入代碼如下所示:使用pregmatch獲取youtube/vimeo id
<iframe width="560" height="315" src="http://www.youtube.com/embed/dbPmWbqAJPs" frameborder="0" allowfullscreen></iframe>
其中ID爲dbPmWbqAJPs。
一個VIMEO嵌入代碼如下所示:
<iframe src="http://player.vimeo.com/video/62468031?color=00ff00" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
凡在本例中,ID爲62468031.
我不想取代那些確切的ID,而是有一個pregmatch/pregreplace在任何嵌入的vimeo和youtube中找到id。
你是否做了一些研究/工作? YouTube ID也包含'-'這樣的字符,而Vimeo ID則是數字。 – hjpotter92 2013-03-27 09:43:58
我有幾個簡單的pregmatch片段,但我不明白它的功能。爲什麼這是低調的,這不是一個有效的問題嗎? – 2013-03-27 09:46:13
你應該包括你在這個問題上嘗試過的任何東西。至於downvote,可能是同樣的原因。 – hjpotter92 2013-03-27 09:48:12