Browse Source

测试browser信息获取

master
ahbmz 4 years ago
parent
commit
240f09bfca
  1. 7
      app/index/controller/Index.php
  2. 3
      composer.json
  3. 66
      composer.lock

7
app/index/controller/Index.php

@ -4,6 +4,9 @@ declare (strict_types=1);
namespace app\index\controller; namespace app\index\controller;
use apanly\BrowserDetector\Browser;
use apanly\BrowserDetector\Device;
use apanly\BrowserDetector\Os;
use app\index\model\User; use app\index\model\User;
use think\Exception; use think\Exception;
@ -24,6 +27,10 @@ class Index
} }
public function index(){ public function index(){
$browser = new Browser(); //浏览器
$os = new Os(); //系统
$device = new Device(); //设备型号
dump($browser->getName(),$browser->getVersion(),$os->getName(),$device->getName());
echo "hello"; echo "hello";
} }

3
composer.json

@ -28,7 +28,8 @@
"topthink/think-migration": "^3.0", "topthink/think-migration": "^3.0",
"doctrine/annotations": "^1.8", "doctrine/annotations": "^1.8",
"zircote/swagger-php": "^3.1", "zircote/swagger-php": "^3.1",
"edward1108/edward-captcha": "^1.1" "edward1108/edward-captcha": "^1.1",
"apanly/browser-detector": "dev-master"
}, },
"require-dev": { "require-dev": {
"symfony/var-dumper": "^4.2", "symfony/var-dumper": "^4.2",

66
composer.lock

@ -4,9 +4,67 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "50d443f74744c72f2c6d804402160cd6", "content-hash": "aedc8c5d0a519ee3dbd6dcf2ee9069eb",
"packages": [ "packages": [
{ {
"name": "apanly/browser-detector",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/apanly/browser-detector.git",
"reference": "220cb27842072100abbe15a838775cb61147c33b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/apanly/browser-detector/zipball/220cb27842072100abbe15a838775cb61147c33b",
"reference": "220cb27842072100abbe15a838775cb61147c33b",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^5.3.3 || ^7.0"
},
"default-branch": true,
"type": "library",
"autoload": {
"psr-4": {
"apanly\\BrowserDetector\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "apanly",
"email": "apanly@163.com"
}
],
"description": "根据UA判断浏览器类型和版本,操作系统,设备型号 ",
"homepage": "http://www.54php.cn",
"keywords": [
"browser",
"detection",
"language",
"operating system",
"os",
"操作系统",
"浏览器",
"设备型号"
],
"support": {
"issues": "https://github.com/apanly/browser-detector/issues",
"source": "https://github.com/apanly/browser-detector/tree/master"
},
"time": "2019-04-17T07:20:36+00:00"
},
{
"name": "doctrine/annotations", "name": "doctrine/annotations",
"version": "1.13.2", "version": "1.13.2",
"source": { "source": {
@ -1790,12 +1848,14 @@
], ],
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": [], "stability-flags": {
"apanly/browser-detector": 20
},
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
"php": ">=7.1.0" "php": ">=7.1.0"
}, },
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.0.0" "plugin-api-version": "2.3.0"
} }

Loading…
Cancel
Save