【问题标题】:Adding a variable into the youtube iframe将变量添加到 youtube iframe
【发布时间】:2014-01-18 05:50:04
【问题描述】:

我正在努力简化我的网站与我们的 YT 观看页面的集成(我们的视频很早就在我们的网站上发布),这就是问题所在。

我正在使用 VideoID 直接从观看页面中提取 cmets、观看次数、标题、描述和其他信息,但是,它不适用于 iframe。我已将 iframe 设置为 php 变量,我需要将视频 id 设置为 iframe 内的变量。

<?php
   $videoid="GeSQHeI5YeQ";

   $iframelink= '<iframe width="640" height="360" src="//www.youtube.com/embed/$videoid" frameborder="0" allowfullscreen></iframe>'; (shows a player with no file)
?>

在页面下方,我使用以下命令调用 iframe(工作正常)

<?php echo $iframelink ?>

谁能帮帮我?我几乎没有这方面的真正经验。

【问题讨论】:

    标签: php variables iframe youtube


    【解决方案1】:

    单引号弄乱了你的代码:

    试试这个:

    <?php
    $videoid="GeSQHeI5YeQ";
    
    $iframelink= <<< EOF
    <iframe width="640" height="360" src="http://www.youtube.com/embed/$videoid" frameborder="0" allowfullscreen></iframe>    
    EOF;
    
    echo $iframelink;
    ?>
    

    【讨论】:

      猜你喜欢
      • 2021-07-12
      • 2016-05-12
      • 2020-05-11
      • 1970-01-01
      • 2013-06-13
      • 2014-03-15
      • 2017-09-17
      • 2018-05-20
      • 1970-01-01
      相关资源
      最近更新 更多