我通常发布代码,但情况略有不同。
我想禁止在移动设备上使用我的注册页面。
例如:icloud.com的登录无法从任何移动设备访问。
所以我得出的结论是,我可能需要抓住用户用户代理,如果它是一个移动平台,则将其重定向到禁用页面?
我真的不知道该怎么做,这意味着可以通过apache2或使用PHP或JS的简单用户代理抓取器来禁用它吗?
您可以使用名为http://mobiledetect.net/
// Include and instantiate the class.
require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect;
// Any mobile device (phones or tablets).
if ( $detect->isMobile() ) {
}
// Any tablet device.
if( $detect->isTablet() ){
}
// Exclude tablets.
if( $detect->isMobile() && !$detect->isTablet() ){
}