問題描述
如果我們只有 URL 或嵌入代碼,誰能告訴我如何顯示或嵌入 YouTube 視頻?
Can anyone give me an idea how can we show or embed a YouTube video if we just have the URL or the Embed code?
推薦答案
您必須要求用戶存儲來自 youtube 視頻的 11 個字符的代碼.
You have to ask users to store the 11 character code from the youtube video.
例如http://www.youtube.com/watch?v=Ahg6qcgoay4
十一個字符的代碼是:Ahg6qcgoay4
The eleven character code is : Ahg6qcgoay4
然后您將這段代碼放入您的數(shù)據(jù)庫中.然后,無論您想將 YouTube 視頻放置在頁面中的哪個位置,從數(shù)據(jù)庫中加載該角色并輸入以下代碼:-
You then take this code and place it in your database. Then wherever you want to place the youtube video in your page, load the character from the database and put the following code:-
例如對于 Ahg6qcgoay4,它將是:
e.g. for Ahg6qcgoay4 it will be :
<object width="425" height="350" data="http://www.youtube.com/v/Ahg6qcgoay4" type="application/x-shockwave-flash"><param name="src" value="http://www.youtube.com/v/Ahg6qcgoay4" /></object>
這篇關(guān)于如何在 PHP 中嵌入 YouTube 視頻?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!