For a better user experience, this topic is supported by default WAP and Web two access styles, WAP Access will not contain any script, style is also re-compose, do not support more pages, only support home page, detail page, comment box, login and other content will be updated to WAP content. If you want to test, you can use the phone to access http://qianduanblog.com try, is not the effect and computer access is not the same?
The following is a function for accessing the type of access (from the Internet):
After testing, the following judgment is wrong.
- /***************************************************
- * * return type of access (WAP web)
- * * December 2, 2012 22:21:20
- ***************************************************/
- function yundanran_get_access_type()
- {
- $is _wap=false;
- //If there is http_x_wap_profile, it must be a mobile device .
- if (isset($_server[' Http_x_wap_profile ']))
- {
- $is _wap=true;
- }
- Else
- {
- //If via information contains WAP, it must be a mobile device, some service associations block this information
- if(isset($_server[' Http_via ']))
- {
- //cannot be found for flase, otherwise true
- $is _wap=stristr($_server[' Http_via '],"WAP") ? true : false;
- }
- Else
- {
- //Protocol law, because there may be inaccuracies, put to the final Judgment
- if (isset($_server[' http_accept ']))
- {
- //If only WML is supported and HTML is not supported it must be a mobile device .
- //If WML and HTML are supported but WML is a mobile device before HTML
- if
- (
- (strpos ([ ' http_accept ' ], ' VND.WAP.WML ' ) !== Span class= "KWD" >false)
- && ( strpos ($_server[], ' text/html ' ) === false
- ¦¦ (strpos($_server[' http_accept '], ' vnd.wap.wml ') < strpos($_server[' http_accept '], ' text/html ' )))
- )
- {
- $is _wap=true;
- }
- }
- }
- }
- return $is _wap?' WAP ':' web ';
- }
- The correct method of judging will be written in the near future:
╮(╯▽╰)╭, a stupid method, judged by UA, comes from a large front end:
-
- /***************************************************
- * * return type of access (WAP web)
- * * December 2, 2012 22:21:20
- * * December 3, 2012 22:30:00
- ***************************************************/
- function yundanran_get_access_type()
- {
- $is _wap=false;
- $user _agent = $_server[' http_user_agent '];
- $mobile _agents = Array
- (
- "240x320","Acer","Acoon","acs-","Abacho","Ahong", "Airness",
- "Alcatel","Amoi","Android","anywhereyougo.com","applewebkit/525",
- "applewebkit/532","Asus","audio","Au-mic","Avantogo",
- "Becker","BenQ","Bilbo","Bird","BlackBerry","Blazer"," Bleu ",
- "cdm-","Compal","Coolpad","Danger","Dbtel","Dopod" ,"Elaine",
- "Eric","Etouch","Fly","Fly_","fly-","Go.web"," Goodaccess ",
- "Gradiente","Grundig","Haier","Hedy","Hitachi","HTC" ,
- "Huawei" , "Hutchison" Span class= "pun" >, "Inno" , "ipad" , "iPAQ" , "ipod" , "Jbrowser" Span class= "pun",
- "KDDI" , "KGT" , "KWC" , "Lenovo" ,< span class= "str" > "LG" , "LG2" , "LG3" , "LG4" , "LG5"
- "Lg7","Lg8","Lg9","lg-","lge-","Lge9","Longcos", "Maemo",
- "Mercator","Meridian","Micromax","MIDP","Mini","Mitsu" ,
- "MMM","MMP","mobi","mot-","moto","nec-","NetFront" ,"Newgen",
- "Nexian","Nf-browser","Nintendo","Nitro","Nokia","Nook" ,
- "Novarra","Obigo","Palm","Panasonic","Pantech","Philips",
- "Phone","pg-","PlayStation","pocket","pt-","qc-", "Qtek",
- "Rover","Sagem","sama","Samu","Sanyo","Samsung","sch-" ,
- "Scooter","sec-","Sendo","sgh-","sharp","Siemens", "sie-",
- "SoftBank","Sony","Spice","Sprint","SPV","Symbian"," Tablet ",
- "Talkabout","tcl-","Teleca","Telit","Tianyu","tim-" ,"Toshiba",
- "TSM","Up.browser","Utec","Utstar","Verykool","Virgin", "vk-",
- "Voda","Voxtel","VX","WAP","Wellco","Wig Browser", "Wii",
- "Windows CE","wireless","XDA","Xde","ZTE"
- );
- $is _wap = false;
- foreach ($mobile _agents as $device)
- {
- if (stristr($user _agent, $device))
- {
- $is _wap = true;
- break;
- }
- }
- return $is _wap?' WAP ':' web ';
- }
- Reprinted from Http://qianduanblog.com/post/php-get-access-source.html
PHP Access Source (WAP access, PC Web Access)