问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

PHP怎么判断终端是不是电脑访问

发布网友 发布时间:2022-04-06 02:15

我来回答

1个回答

热心网友 时间:2022-04-06 03:44

这是JS代码,PHP也可以做到

   

//判断是否属手机
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() ){
  echo '该页面是手机页面,请使用移动设备访问,谢谢!';
}

网上有很多这样的代码,不满意可以找找

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
临沂比较有名的男装品牌 呼伦贝尔市悦动网络科技有限公司怎么样? 呼伦贝尔中汇实业有限公司怎么样? 呼伦贝尔油玉不绝电子商务有限公司怎么样? 如何避免wps卡顿? 属鼠的男人找对象是属什么,属鼠的人和什么属相合 96年鼠的姻缘在哪年 属相相合年份运势提升 2024属鼠找对象属什么最佳 黑客攻击网站能报案吗 黑客攻击报案有用吗 ThinkPHP中判断是手机端还是电脑端访问的方法 php 区分手机 和 pc 访问 php如何判断客户端是pc还是手机 php 获取访问客户端是pc端还是手机端 php判断终端是手机还是电脑访问网站 php判断用户是电脑还是手机Pad访问 php怎么判断客户是用手机还是用电脑访问的网站? php 判断是电脑还是手机浏览器打开 PHP CI 框架 怎么在访问的是否区分手机 和 电脑访问 php检测用户是 手机端还是电脑端 PHP判断是手机端访问还是PC端访问网站 php如何判断用户通过手机wap访问还是电脑直接访问 php如何判断是手机访问还是电脑访问 wamp如何升级php apache mysql php.ini怎么设置才能加载 每次重开机时wampserver在桌面右下角处的php.ini文件都成了空文件,是为什么呀。 WAMP中 apache和php目录下的php.ini有什么区别 如何修改wamp的默认访问目录 wamp怎么还原php.ini 有两个PHP.INI文件,选择哪一个修改include_path。安装smarty,我用的是wamp环境。求大神指点。 php 怎么把当前的日期转换成时间戳 ThinkPHP 如何把获取到的日期格式的时间转化为时间戳 PHP 将输出时间转变为时间戳的问题 登录图片看不清换另一张,如何用js实现 asp.net里的验证码怎么实现 “看不清换一张”是怎么实现的 电脑系统登录时验证码只显示看不清换一张图怎么办? 验证码看不清怎么用程序来实现 为什么我点一下验证码的“看不清换一张”时,页面的所有的内容都没有了呢?怎样才能留住它呢? 用PHP技术制作验证码遇到的问题。 PHP验证码 实现点击刷新 PHP刷新验证码问题 不同框架下 实现php验证码。。。 php html关于局部刷新验证码图片的问题 php怎么生成6位的不重复的字符串 PHP 随机文字不重复 要从几十个之间随机让他显示8个 这8个彼此不重复 该怎么修改 以下代码能随机但是重复 求一串完整的php代码+html php随机生成10位数字,而且永远不会重复,在一个单行文本框内输出 有什么方法,生成100个不重复的6位字符串 php 查看一个变量是否是静态变量的函数是什么? 如何判断类的静态方法是否存在? - 技术问答 如何知道PHP是动态还是静态