0
私は次の機能を使ってビデオをYouTubeに表示していますが、複数のビデオを置き換える方法がわからないのはなぜですか?最初に埋め込まれたyoutubeビデオ
PHPコード:
function embedYoutube($text)
{
$pattern = '/[\\?\\&]v=([^\\?\\&]+)/';
$replacement = '<div style="width:100%;float:left;margin-top:15px;margin-bottom:15px;"><iframe width="570" height="315" src=http://www.youtube.com/embed/$1 frameborder="0" allowfullscreen></iframe></div>';
return preg_replace($pattern, $replacement, $text);
}
これはかなり簡単でした。 – fxuser