如果我们只有 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
然后您将这段代码放入您的数据库中.然后,无论您想将 YouTube 视频放置在页面中的哪个位置,从数据库中加载该角色并输入以下代码:-
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>
这篇关于如何在 PHP 中嵌入 YouTube 视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!