这篇文章结合实例主要介绍了php如何判断手机系统,有一定的参考价值,感兴趣的朋友可以看看,希望可以帮助到你!
现在很流行扫二维码来下载App,你知道其中的原理吗?
扫描的二维码本质是一个链接,这个链接会执行一个方法,根据不同的手机系统跳转到不同的App下载平台。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | header( "Content-type:text/html; charset=utf-8" );
$user_agent = $_SERVER [ 'HTTP_USER_AGENT' ];
if ( stristr ( $_SERVER [ 'HTTP_USER_AGENT' ], 'Android' )){
header( 'Location: http://xxx' );
} else if ( stristr ( $_SERVER [ 'HTTP_USER_AGENT' ], 'iPhone' )){
header( 'Location: https://xxx' );
} else if ( stristr ( $_SERVER [ 'HTTP_USER_AGENT' ], 'WindowsPhone' )){
header( 'Location: http://xxx' );
} else {
header( 'Location: http://xxx' );
}
|
Copier après la connexion
【相关教程推荐】
1. php编程从入门到精通全套视频教程
2. php从入门到精通
3. bootstrap教程