1、php判断http请求还是https请求$http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
2、js判断http请求还是https请求
`var ishttps = 'https:' == document.location.protocol ? true: false;
if(ishttps){
alert('https');
}else{
alert('http');
}`
3、js判断手机端和PC端
`<SCRIPT type=text/javascript>
//uaredirect("/vida/xinfeng/mobi/moshare/share.html");
try {
var urlhash = window.location.hash;
if (!urlhash.match("fromapp"))
{
var ishttps = 'https:' == document.location.protocol ? 'https://': 'http://';
//console.log(document.location.protocol);
//console.log(ishttps);
if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)))
{
window.location= ishttps+"www.baidu.com/share.html";
}
if((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)) && (/MicroMessenger/i.test(navigator.userAgent))){
window.location= ishttps+"www.baidu.com/share.html";
}
}
}
catch(err)
{
}
</SCRIPT>`
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。