我刚刚遇到了php-mobile-detect,我想把它添加到我的网站上。到目前为止,我当前的代码是。
<?php
include("Mobile_Detect.php");
$detect = new Mobile_Detect();
?>
<?php if($detect->isiPad()) {
echo '<link rel="stylesheet" href="test.css" type="text/css">';
}
?>现在我想做的就是将所有的iPhones,安卓设备,黑莓等添加到一个css中,并将任何其他的桌面版本添加到另一个css中?
我知道我快到了,但我不能完全到达那里。
发布于 2013-02-19 20:06:12
这应该会对你起作用:
<?php
include("Mobile_Detect.php");
$detect = new Mobile_Detect();
if ($detect->isMobile()) {
echo 'mobile';
}else{
echo 'desktop';
}
?>https://stackoverflow.com/questions/14956914
复制相似问题