2

I want to make a PHP script that parse ANY youtube link/url and makes an output of iframe that i can later store in SQL database and insert on my site.

Any help appreciated

EDIT & ANSWEAR

1) get video ID

$step1=explode('v=', $url);
$step2 =explode('&',$step1[1]);
$vedio_id = $step2[0];

2) create iframe

<iframe width="320" height="240" src="http://www.youtube.com/embed/'. $vedio_id.'?autoplay=1" frameborder="0"></iframe>
4

1 回答 1

2

我找到了答案。您需要一个将 url 转换为嵌入代码的脚本检查此链接URL 到嵌入代码 PHP 脚本

使用此脚本,您可以将任何 youtube 或 vimeo 链接转换为嵌入代码,您无需将嵌入代码保存在 db 中,只需保存 vedio id。:)

于 2013-08-12T08:19:45.663 回答