我正在使用它,但似乎不起作用,我做错了什么?谢谢!
<?php if(strlen(strstr($agent,"Firefox")) > 0 ){ ?>
<object width="692" height="389">
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=VIDEO_ID&server=vimeo.com&color=00adef&fullscreen=1" />
<embed src="http://vimeo.com/moogaloop.swf?clip_id=<?php the_field('vimeo'); ?>&server=vimeo.com&color=00adef&fullscreen=1"
type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="692" height="389"></embed>
</object> <?php } else { ?>
<iframe src="http://player.vimeo.com/video/<?php the_field('vimeo'); ?>" width="692" height="389" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen> </iframe>
<?php } ?>
它不是过滤,我在Firefox中获取iframe而我不想因为我想要拥有&lt;对象&gt;嵌入firefox
答案 0 :(得分:1)
strstr区分大小写,请尝试使用stristr而不是不区分大小写并更改&gt; 0到!== false。
http://www.php.net/manual/en/function.stristr.php
另外,您是否可以提供有关如何填充$ agent的更多详细信息?您应该使用$ _SERVER ['HTTP_USER_AGENT'];
填充$ agent答案 1 :(得分:0)
这似乎有效:
<?php
if(strlen(strstr($_SERVER['HTTP_USER_AGENT'],"Firefox")) <= 0 ){ ?>
<iframe src="http://player.vimeo.com/video/<?php the_field('vimeo'); ?>" width="692" height="389" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
<?php } else { ?>
<object width="692" height="389">
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=VIDEO_ID&server=vimeo.com&color=00adef&fullscreen=1" />
<embed src="http://vimeo.com/moogaloop.swf?clip_id=<?php the_field('vimeo'); ?>&server=vimeo.com&color=00adef&fullscreen=1"
type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="692" height="389"></embed>
</object>
<?php } ?>
<?php else: ?>
<?php
if(strlen(strstr($_SERVER['HTTP_USER_AGENT'],"Firefox")) <= 0 ){ ?>
<iframe src="http://player.vimeo.com/video/<?php the_field('vimeo'); ?>" width="692" height="389" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
<?php }