{"id":68,"date":"2015-06-05T11:02:42","date_gmt":"2015-06-05T03:02:42","guid":{"rendered":"http:\/\/www.cxybj.com\/?p=68"},"modified":"2015-06-05T11:02:42","modified_gmt":"2015-06-05T03:02:42","slug":"php%e8%af%86%e5%88%ab%e5%ae%a2%e6%88%b7%e7%ab%af%e6%98%af%e7%94%b5%e8%84%91%e5%92%8c%e6%89%8b%e6%9c%ba%e7%9a%84%e8%ae%bf%e9%97%ae%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/www.cxybj.com\/?p=68","title":{"rendered":"PHP\u8bc6\u522b\u5ba2\u6237\u7aef\u662f\u7535\u8111\u548c\u624b\u673a\u7684\u8bbf\u95ee\u51fd\u6570"},"content":{"rendered":"<pre>&lt;?php\r\nfunction isMobile(){  \r\n\t$useragent=isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';  \r\n\t$useragent_commentsblock=preg_match('|\\(.*?\\)|',$useragent,$matches)&gt;0?$matches[0]:'';  \t  \r\n\tfunction CheckSubstrs($substrs,$text){  \r\n\t\tforeach($substrs as $substr)  \r\n\t\t\tif(false!==strpos($text,$substr)){  \r\n\t\t\t\treturn true;  \r\n\t\t\t}  \r\n\t\t\treturn false;  \r\n\t}\r\n\t$mobile_os_list=array('Google Wireless Transcoder','Windows CE','WindowsCE','Symbian','Android','armv6l','armv5','Mobile','CentOS','mowser','AvantGo','Opera Mobi','J2ME\/MIDP','Smartphone','Go.Web','Palm','iPAQ');\r\n\t$mobile_token_list=array('Profile\/MIDP','Configuration\/CLDC-','160\u00d7160','176\u00d7220','240\u00d7240','240\u00d7320','320\u00d7240','UP.Browser','UP.Link','SymbianOS','PalmOS','PocketPC','SonyEricsson','Nokia','BlackBerry','Vodafone','BenQ','Novarra-Vision','Iris','NetFront','HTC_','Xda_','SAMSUNG-SGH','Wapaka','DoCoMo','iPhone','iPod');  \r\n\t\t  \r\n\t$found_mobile=CheckSubstrs($mobile_os_list,$useragent_commentsblock) ||  \r\n\t\t\t  CheckSubstrs($mobile_token_list,$useragent);  \r\n\t\t  \r\n\tif ($found_mobile){  \r\n\t\treturn true;  \r\n\t}else{  \r\n\t\treturn false;  \r\n\t}  \r\n}\r\nif (isMobile())\r\n\techo '\u624b\u673a\u767b\u5f55cxybj.com';\r\nelse\r\n\techo '\u7535\u8111\u767b\u5f55cxybj.com';\r\n?&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&lt;?php function isMobile(){  &hellip; <a href=\"https:\/\/www.cxybj.com\/?p=68\" class=\"more-link\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[41,39,40],"_links":{"self":[{"href":"https:\/\/www.cxybj.com\/index.php?rest_route=\/wp\/v2\/posts\/68"}],"collection":[{"href":"https:\/\/www.cxybj.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cxybj.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cxybj.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cxybj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=68"}],"version-history":[{"count":1,"href":"https:\/\/www.cxybj.com\/index.php?rest_route=\/wp\/v2\/posts\/68\/revisions"}],"predecessor-version":[{"id":69,"href":"https:\/\/www.cxybj.com\/index.php?rest_route=\/wp\/v2\/posts\/68\/revisions\/69"}],"wp:attachment":[{"href":"https:\/\/www.cxybj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=68"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cxybj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=68"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cxybj.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=68"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}