0
<html>
<?php
$url = "http://www.youtube.com/embed/FTGNAupPqpU";
$str = "title of video here";
$css = <<<EOT
<style type="text/css">
 body
   {
   background: #eeeeee;
   width:560px; 
   height:315px;
   }
</style>
EOT;
$data = file_get_contents($url);
$data = str_replace('</body>', $css.'</body>', $data);
echo '<div style="overflow:scroll;">'.$data.'</div>';
echo $str
?>
</html>

変数が格納されている場合$url(主に YouTube ビデオ) はまったくエコーしませんが、何もエコーしない$str場合は理由がわかりません。動画を上部に表示して、動画のタイトルとして使用したいと考えています。$url$str$str

4

2 に答える 2

4

ビデオコンテナとボディの高さが同じだったので、そのdivの後のすべてのコンテンツが非表示になりましたこれが機能するかどうかを確認してください:

<html>
<?php
$url = "http://www.youtube.com/embed/FTGNAupPqpU";
$str = "title of video here";
$css = <<<EOT
<style type="text/css">
 body
   {
   background: #eeeeee;
   width:560px; 
   height:315px;
   color:#000;
   }
</style>
EOT;
$data = file_get_contents($url);
$data = str_replace('</body>', $css.'</body>', $data);
echo '<div style="overflow:scroll; height:300px;">'.$data.'</div>';
echo $str;
?>
</html>
于 2013-05-15T11:53:46.313 に答える