我制作了一个 video.php 页面,该页面将根据 youtube 上视频的 ID 显示来自 youtube 的视频,所以我做了类似的东西
if($_GET['id']=="jquery11"){
?>
<div id="video" ><iframe width="640" height="360" src="http://www.youtube.com/embed/6PM6t5RFR2w?autoplay=1&controls=2" frameborder="5" allowfullscreen></iframe></div>
<?
}
if($_GET['id']=="jquery12"){
?>
<div id="video" ><iframe width="640" height="360" src="http://www.youtube.com/embed/fE0GC7KFIno?autoplay=1&controls=2" frameborder="5" allowfullscreen></iframe></div>
<?
}
if($_GET['id']=="jquery13"){
?>
<div id="video" ><iframe width="640" height="360" src="http://www.youtube.com/embed/xuFa2R4c6Gc?autoplay=1&controls=2" frameborder="5" allowfullscreen></iframe></div>
<?
}
if($_GET['id']=="jquery14"){
?>
<div id="video" ><iframe width="640" height="360" src="http://www.youtube.com/embed/M971xYWiS7M?autoplay=1&controls=2" frameborder="5" allowfullscreen></iframe></div>
<?
}
if($_GET['id']=="jquery15"){
?>
<div id="video" ><iframe width="640" height="360" src="http://www.youtube.com/embed/oZ_J422z4WI?autoplay=1&controls=2" frameborder="5" allowfullscreen></iframe></div>
<?
}
if($_GET['id']=="jquery16"){
?>
<div id="video" ><iframe width="640" height="360" src="http://www.youtube.com/embed/tYJMitUfSvs?autoplay=1&controls=2" frameborder="5" allowfullscreen></iframe></div>
<?
}
if($_GET['id']=="jquery17"){
?>
<div id="video" ><iframe width="640" height="360" src="http://www.youtube.com/embed/wZPhQzqGzls?autoplay=1&controls=2" frameborder="5" allowfullscreen></iframe></div>
<?
}
if($_GET['id']=="jquery18"){
?>
<div id="video" ><iframe width="640" height="360" src="http://www.youtube.com/embed/Cdwn2JoCYQ0?autoplay=1&controls=2" frameborder="5" allowfullscreen></iframe></div>
<?
}
if($_GET['id']=="jquery19"){
?>
<div id="video" ><iframe width="640" height="360" src="http://www.youtube.com/embed/cKCiNf23Atg?autoplay=1&controls=2" frameborder="5" allowfullscreen></iframe></div>
<?
}
?>
有什么想法可以改变这种方法来减少获取请求吗?我尝试制作关联数组,但我认为它是一样的