Do a PHP landing page, with a PC landing and using the mobile phone landing on the landing page is not the same.

Source: Internet
Author: User

<?php
Header (' content-type:text/html; Charset=utf-8 ');//define page encoding as UTF8
$is _pc = (Strpos ($agent, ' Windows NT '))? Whether the true:false;//is a PC PC-side
$is _mobi = (Strpos ($agent, ' Mobile '))? Whether the true:false;//is a mobile end
$is _iphone = (Strpos ($agent, ' iphone ')? Whether true:false;//is an iphone
$is _ipad = (Strpos ($agent, ' ipad ')? true:false;//is the ipad
$is _android = (Strpos ($agent, ' Android ')? Whether true:false;//is an Android
Self-feeling PHP header ("locaion:") jump page than HTML <meta> jump to use, compatible with more browsers, I have used <meta> auto jump page, the browser is not moving, finally changed to the header is good
if ($is _pc) {
Header ("Location:dhu_login_pc.php");
Exit
Here to jump to the computer page, it is better to first judge
}if ($is _iphone) {
Header ("Location:dhu_login_mobile.php");//Jump to iphone page here
Exit
}elseif ($is _ipad) {
Header ("Location:dhu_login_mobile.php");//jump to the ipad page here
Exit
}if ($is _android) {
Header ("Location:dhu_login_mobile.php");//This URL jumps to the Android page
Exit
}else{
Header ("Location:dhu_login_mobile.php")//The last page should be set to the low end of the mobile page, or non-HTML5, such as consumption of the page, judge to the end, you can know with the agent or real mobile phone non-high-end

Exit
}
?>
Other:
Header ("Location:dhu_login_pc.php"), the implementation of the function is to jump dhu_login_pc.php page, time interval of 0 seconds, when using it, the front can not have output, after use to immediately exit;

Do a PHP landing page, with a PC landing and using the mobile phone landing on the landing page is not the same.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.