composer
安装composer require jenssegers/agent
config\app.php
中注册服务提供者Add the service provider in config/app.php:
Jenssegers\Agent\AgentServiceProvider::class,
And add the Agent alias to config/app.php:
‘Agent‘ => Jenssegers\Agent\Facades\Agent::class,
3.1引用类
use Jenssegers\Agent\Agent;
3.2实例化
Agent
对象
$agent = new Agent();
原文:https://www.cnblogs.com/yaoliuyang/p/13194282.html