<?php 
header("Content-type:text/html;charset=utf-8"); 
function is_mobile(){ 
$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","inno","ipad","ipaq","ipod","jbrowser","kddi","kgt","kwc","lenovo","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_mobile = false; 
foreach ($mobile_agents as $device) { 
if (stristr($user_agent, $device)) { 
$is_mobile = true; 
break; 


return $is_mobile; 

if(is_mobile()){ 
header("Location:你的手机网址");
}else{ 
header("Location:你的电脑网址");
}

php判断是手机还是pc访问从而走不同url的更多相关文章

  1. js判断是手机还是电脑访问网站

    js判断是手机还是电脑访问网站                               <script type="text/javascript"> <!- ...

  2. 判断是手机还是PC端访问

    /*判断手机*/ //判断是手机浏览还是pc //平台.设备和操作系统 var system = { win: false, mac: false, xll: false, ipad: false } ...

  3. ThinkPHP在入口文件中判断是手机还是PC端访问网站

    <?php// +----------------------------------------------------------------------// | ThinkPHP [ WE ...

  4. js判断是手机还是PC端

    有时接触一些手机上的适应,需要知道是pc 还是移动端 function IsPC() { var userAgentInfo = navigator.userAgent; var Agents = [ ...

  5. javascript如何判断是手机还是电脑访问本网页

    var system ={}; var p = navigator.platform; system.win = p.indexOf("Win") == 0; system.mac ...

  6. 利用JS判断是否手机或pad访问

    <script type="text/javascript"> /* * 智能机浏览器版本信息: * */ var browser={ versions:functio ...

  7. php或js判断网站访问者来自手机或者pc端源码

    很多时候也可以通过逻辑程序来进行判断,如PHP.JS是常用的两种识别访问设备类型的常用方法. 原理都是采用识别访问客户端的HTTP_USER_AGENT,然后进行关键字匹配进行确定设备类型,对于伪造H ...

  8. PHP 判断终端是手机还是电脑访问网站代码

    用thinkphp做底层框架,判断客户是用pc访问还是手机访问的. <?php $platform = platform();//检测访问平台 //print_r($_SERVER);DIE; ...

  9. 判断用户是pc访问还是手机访问

    前天因为手机页面中点击无法链接53客服,就研究了下怎样通过js判断,用户是拿手机(ipad)访问,还是pc端访问, 如果是手机访问的话只需把链接通过attr修改a的链接地址~ <a class= ...

随机推荐

  1. Unity3D for VR 学习(2): 暴风魔镜框架探索

    学习一个新技术,有三个法宝: 法宝1: 掌握厂家提供的用户API手册 法宝2: 掌握厂家提供的demo样例 法宝3:<每个研发人员都应树立的一个demo模式> 故,学习魔镜4技术,亦如是也 ...

  2. Linux内核设计与实现第六周读书笔记

    第三章 进程管理 3.1 进程 进程是处于执行期的代码.通常进程还要包含其他资源,像打开的文件.挂起的信号.内核的内部数据.处理器状态.一个或多个具有内存映射的内存地址空间及一个或多个执行线程,当然还 ...

  3. 解题:SCOI 2014 方伯伯运椰子

    题面 很有趣的一道题,看起来是个神奇网络流,其实我们只要知道网络的一些性质就可以做这道题了 因为题目要求流量守恒,所以我们其实是在网络中搬运流量,最终使得总费用减小,具体来说我们可以直接把这种“搬运” ...

  4. 【CF375C】Circling Round Treasures

    Portal --> CF375C Solution 一个有趣的事情:题目中有很大的篇幅在介绍如何判断一个位置在不在所围的多边形中 那么..给了方法当然就是要用啊 ​ 首先是不能包含\('B'\ ...

  5. 【单调队列】【P3957】 跳房子

    传送门 Description 跳房子,也叫跳飞机,是一种世界性的儿童游戏,也是中国民间传统的体育游戏之一. 跳房子的游戏规则如下: 在地面上确定一个起点,然后在起点右侧画 $n$ 个格子,这些格子都 ...

  6. Oracle 解决【ORA-01704:字符串文字太长】(转)

    错误提示:oracle在toad中执行一段sql语句时,出现错误‘ORA-01704:字符串文字太长’.如下图: 原因:一般为包含有对CLOB字段的数据操作.如果CLOB字段的内容非常大的时候,会导致 ...

  7. selenium - 查看selenium版本信息

    1. pip list 2. pip show selenium 3. cmd>>python >>> import selenium>>> help( ...

  8. Qt ------ 再论事件循环

    在介绍在以前,我们要认识两个术语: 可重入的(Reentrant):如果多个线程可以在同一时刻调用一个类的所有函数,并且保证每一次函数调用都引用一个唯一的数据,就称这个类是可重入的(Reentrant ...

  9. 线上Redis偶发性链接失败排查记

    问题过程 输入法业务于12月12日上线了词库接受业务,对部分用户根据用户uuid判断进行回传,在12月17日早上8点多开始出现大量的php报错(Redis went away),报错导致了大量的链接积 ...

  10. cxf开发webservice服务器+客户端(各种类型的参数传递返回)

    开发环境:eclipse3.7+jdk1.6.0_29+tomcat6.0.37 XFire搭建webservice: http://www.cnblogs.com/gavinYang/p/35253 ...