weesee / yii2-system-info
用于操作系统信息的Yii2扩展
1.1.0
2018-07-26 20:46 UTC
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2024-09-29 06:20:59 UTC
README
提供关于您系统/服务器的信息。
它会自动检测您使用的系统类型,并提供相应信息。
支持的操作系统
- Windows
- Linux
- OSX (Darwin)
方法
- getOS
- getKernelVersion
- getHostname
- getCpuModel
- getCpuVendor
- getCpuFreq
- getCpuArchitecture
- getCpuCores
- getLoad
- getUpTime
- getPhpVersion
- getServerName
- getServerProtocol
- getServerSoftware
- getTotalMemory
安装
将 System-Info 添加到您的 composer.json 文件的 require 部分
{ "require": { "weesee/yii2-system-info": "~1.1.0" } }
然后运行以下命令使用 composer 下载扩展
$ php composer.phar update
使用方法
在控制器/操作中获取所有数据
use weesee\systemInfo\models\SystemInfo; public function actionShowinfo() { // Initialize Information to work with the current operating system $sysInfo = new SystemInfo(); // get system details as Yii2 model $sysInfo->getInfo(); // hand it over to view return $this->render('sysinfo',['sysInfo'=>$sysInfo]); }
并在视图中使用模型显示
echo DetailView::widget([ 'model' => $sysInfo, 'attributes' => $sysInfo->attributes(), ]); echo $sysInfo->totalMemory;
常见问题解答
COM
未找到
从 PHP 5.4.5
开始,COM
已不再内置到 PHP 核心中。您需要在 php.ini
中添加 COM
支持
[COM_DOT_NET]
extension=php_com_dotnet.dll
否则您将在错误日志中看到此信息:Fatal error: Class \'COM\' not found
贡献
贡献说明位于 CONTRIBUTING.md 文件。
作者 & 致谢
作者: weesee@web.de
致谢
(C) 2018 WeeSee