基于PHP变量嵌入YouTube视频 [英] Embedding a YouTube Video Based on a PHP Variable

查看:113
本文介绍了基于PHP变量嵌入YouTube视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我正在为一个课程项目创建的网站。该网站显示有关乐队的信息(存储在mysql数据库中)。我正在努力整理网站,并且我想根据乐队名称嵌入YouTube视频。比如说,我的Led Zeppelin存储在我的数据库中。我如何获取包含Led Zeppelin的PHP变量,使用该变量搜索YouTube,查找随机视频,然后将其嵌入到网站中?从我所做的研究来看,如果您知道视频的确切地址,则只能嵌入YouTube视频。
Thanks!

I have a website that I am creating for a class project. The website shows information about bands (which is stored in a mysql database). I am trying to spruce up the site a bit, and I would like to embed a YouTube video based on the band's name. Say, for instance, I have "Led Zeppelin" stored in my database. How can I take a PHP variable containing "Led Zeppelin", search YouTube using that variable, find a random video, and then embed that in the website? From the research I've done, it seems you can only embed YouTube videos if you know the exact address of the video. Thanks!

推荐答案

您可以使用youtube PHP API
http://code.google.com/apis/youtube/2.0/developers_guide_php.html#Searching_for_Videos

You can do that using the youtube PHP API http://code.google.com/apis/youtube/2.0/developers_guide_php.html#Searching_for_Videos

这篇关于基于PHP变量嵌入YouTube视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆