kufeisoft / ua
get os info from useragent
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=5.3
This package is auto-updated.
Last update: 2024-05-20 07:13:04 UTC
README
By 酷飞软件
Installation
Use Composer to install the library.
$ composer require kufeisoft/ua
Basic usage
- 获取用户操作系统信息
$serverName = \kufeisoft\Ua::getOS($ua = ""); print_r($serverName); // 返回的值是一个数组 // 返回结果: // ['server' => '操作系统', 'version' => '版本号']
Demo
$ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36', ; $serverInfo = \kufeisoft\Ua::getOS($ua); print_r($serverInfo); // 输出结果 // ['server' => 'Mac OS X', 'version' => '10.15.7']
Advanced usage
通过用户传入的useragent串来返回用户操作系统类型及版本号
Built-in validation reader
想好了再写
License
This bundle is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code.