我想添加一个自动选择iframe
"正在运行"两个人之间在我的网站上播放视频。
我需要在PHP / JavaScript中使用决策块从两者中自动选择1 iframe
。
在某些国家/地区,视频会从一个iframe
播放,而在其他国家/地区播放的视频则来自两个iframe。
所以我想添加一种方式,以便任何地方的任何用户都可以观看视频。
通常我直接使用这个
<div id="video" style="margin-top:10px;"><iframe width="940" height="420" src="http://www.youtube.com/embed/<?php echo $_GET['v'] ;?>?autoplay=1&vq=medium&modestbranding=1&showinfo=0" frameborder="0" allowfullscreen></iframe>
但现在我想再添加一个iframe
,就在这里
<div id="video" style="margin-top:10px;"><iframe width="940" height="420" src="http://www.v.ytapi.com/embed/<?php echo $_GET['v'] ;?>?autoplay=1&vq=medium&modestbranding=1&showinfo=0" frameborder="0" allowfullscreen></iframe>
请帮助我。 谢谢, Medipalace
答案 0 :(得分:0)
您可以在此帖中找到许多回复来了解该国家/地区: PHP - Detect country
例如,您可以使用api hostip
$country = '';
$IP = $_SERVER['REMOTE_ADDR'];
if (!empty($IP)) {
$country = file_get_contents('http://api.hostip.info/country.php?ip='.$IP);
}
您可以测试国家/地区后: if($ country ==&#34; england&#34;){ //你的代码 }