当前位置:首页 > 未分类 > 正文内容

PHP如何判断访问来源是微信小程序、公众号平台、APP

admin3周前 (04-12)未分类41
    //判断是什么平台
    function platform()
    {
        //ll($_SERVER['HTTP_USER_AGENT']);
        $platform='h5';
        $a_strtolower = strtolower($_SERVER['HTTP_USER_AGENT']);
        if(strpos($a_strtolower, "micromessenger"))//公众号MicroMessenger
        {
            if(strpos($a_strtolower, "miniprogram"))//小程序
            {
                $platform = 'mpapp';
            }
            else
                $platform = 'wxapp';
        }
        elseif(strpos($a_strtolower, "uni-app") || strpos($a_strtolower, "Html5Plus"))//app
        {
            $platform = 'app';
        }
        return $platform;
    }


原文链接:http://www.yinzhongnet.com/1311.html

扫描二维码推送至手机访问。

版权声明:本文由服务端开发技术分享发布,如需转载请注明出处。

本文链接:https://www.htmlcms.cn/?id=7

分享给朋友:
返回列表

上一篇:PHP 如何实现 URL 安全的 Base64 编码

没有最新的文章了...

相关文章

数据库--MySQL:Failed to start LSB: start and stop MySQL.

mysql 启动失败Failed to start LSB: start and stop MySQL.Starting MySQL....The server quit without updating PID file (……查看错误日...

ThinkPHP整合PHPMailer实现QQ邮件发送

邮件发送功能在项目中还是非常常用的,比如用户注册发送验证码,用户发送留言邮件,事件提醒功能等。今天我们就用thinkphp整合PHPMailer扩展来实现邮件发送功能。1、QQ邮箱设置    &nbs...

_initialize 和 __construct中不能return

1、构造函数是一个没有返回值的特殊函数,所有即使加上return也没意义,他不会执行的。2、不仅php,所有面向对象的语言的构造函数都没有return。因此正确的方法应该为:namespace app\service\contro...

PHP 如何实现 URL 安全的 Base64 编码

URL 安全的 Base64由于标准的 Base64 编码后可能出现字符 + 和 / ,在 URL 中就不能直接作为参数,所以 URL 安全的 Base64 编码,需要把字符 + ...