How to embed YouTube videos in PHP?(如何在 PHP 中嵌入 YouTube 视频?)
问题描述
如果我们只有 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 视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 PHP 中嵌入 YouTube 视频?


- PHP - if 语句中的倒序 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01