如何为Youtube视频设置自动播放?

Ati*_*zad -5 html php youtube

我有以下代码,我想用它来自动播放YouTube视频.它适用于普通的HTML代码,但是使用下面的PHP代码,我无法自动播放.怎么了?

 if(!isset($_GET['vidid']))
  {
  echo  '<div class="leftcurtain" style="width: 60px; display: block;"><img src="images/2frontcurtain.jpg"/></div>';
  echo  '<div class="rightcurtain" style="width: 60px; display: block;"><img src="images/2frontcurtain.jpg"/></div>';
  echo '    <div class="visible">
  <iframe width="597" height="365" src="';
  echo get_vid_url($vid_id);
    if (get_vid_url($vid_id) == "http://www.youtube.com/embed/be9eQ21OLu0") echo '?autoplay=1'; 
    echo '" frameborder="0" allowfullscreen></iframe>
</div>
<span id="dummy"></span> <a class="rope" href="#" style="top: 10px;"> <img src="images/rope.png"/> </a> </div>';
      }
Run Code Online (Sandbox Code Playgroud)

小智 5

将其添加到您的网址

?autoplay=1
Run Code Online (Sandbox Code Playgroud)

例如 <iframe width="420" height="315" src="http://www.youtube.com/embed/ oHg5SJYRHA0?autoplay=1" frameborder="0" allowfullscreen></iframe>