Home >Backend Development >PHP Tutorial >请问:判断对方是PC还是移动设备,再来设置HTML代码

请问:判断对方是PC还是移动设备,再来设置HTML代码

WBOY
WBOYOriginal
2016-06-20 12:42:21938browse

<iframe src="http://open.iqiyi.com/developer/player_js/coopPlayerIndex.html?vid=4492f84cca29f45dbe907f68366849eb&tvId=5072836609&accessToken=2.f22860a2479ad60d8da7697274de9346&appKey=3955c3425820435e86d0f4cdfe56f5e7&appId=1368&height=100%&width=100%" frameborder="0" allowfullscreen="true" width="100%" height="100%"></iframe><embed src="http://player.video.qiyi.com/2b1d1e29bf54aca7c9c11badc4b697d6/0/0/w_19rt7946ph.swf-albumId=5064083609-tvId=5064083609-isPurchase=0-cnId=12" allowFullScreen="true" quality="high" width="480" height="350" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash"></embed>


回复讨论(解决方案)

两端代码,一段适用于手机,一段只能适用于PC。我希望用PHP代码来判断对方的设备,再来写入播放器代码。

去解析user_agent试试看

去解析user_agent试试看


我看了一下别人的代码HTML里面是这样的

同问怎么判断啊

HTTP协议里,客户端的字段有UserAgent,表示所用的浏览器;根据不同的UserAgent展示页面即可;比如,iPhone手机的UserAgent,一般是iPhone;

判断再重新定义代码,用PHP或者ASP.NET都可以吧。。。楼主要自定义

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn