如何在PHP中获取系统信息? [英] How to get system info in PHP?
问题描述
我想获取PHP中的系统内存使用情况(以及HDD空间信息).有什么方法可以不使用system
调用来调用命令?
I want to get the system memory usage (and also HDD space info) in PHP. Is there any way to do without invoking commands using system
calls?
注意:我不是在寻找脚本内存使用率,而是系统内存使用率.
Note: I am not looking for the script memory usage, but the system memory usage.
推荐答案
在Linux上,您可以阅读/proc/meminfo
以获得有关总内存和可用系统内存的信息(仅cat /proc/meminfo
-这是一个简单的文本文件,您可以轻松地解析).
On Linux, you can read /proc/meminfo
to get information on total and available system memory (just cat /proc/meminfo
-- it's a simple text file you can easily parse).
我不确定是否可以通过尝试查看/proc/sys/fs
以获得有趣的信息来从procfs中获取文件系统信息.
I'm not sure you can get filesystem information from procfs, by try looking at /proc/sys/fs
for interesting information.
这篇关于如何在PHP中获取系统信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!