全局变量应该没有,不过get_headers()函数可以返回服务器状态
<php
$url = '网址';
$header = get_headers($url, 1);
echo '状态为:'$header[0]'<br />';
//
preg_match('/\d{3}/',$header[0],$code);
echo '数字状态码为:'$code[0]'<br />';
>
>>> import psutil
>>> psutilcpu_times()
scputimes(user=396146, nice=169729, system=2150659, idle=16900540, iowait=62959, irq=00, softirq=1942, steal=00, guest=0, nice=00)
>>>
>>> for x in range(3):
psutilcpu_percent(interval=1)
40
59
38
>>>
>>> for x in range(3):
psutilcpu_percent(interval=1, percpu=True)
[40, 69, 37, 92]
[70, 85, 24, 21]
[12, 90, 99, 72]
>>>
>>>
>>> for x in range(3):
psutilcpu_times_percent(interval=1, percpu=False)
scputimes(user=15, nice=00, system=05, idle=965, iowait=15, irq=00, softirq=00, steal=00, guest=00, guest_nice=00)
scputimes(user=10, nice=00, system=00, idle=990, iowait=00, irq=00, softirq=00, steal=00, guest=00, guest_nice=00)
scputimes(user=20, nice=00, system=00, idle=980, iowait=00, irq=00, softirq=00, steal=00, guest=00, guest_nice=00)
>>>
>>> psutilcpu_count()
4
>>> psutilcpu_count(logical=False)
2
>>>
以上就是关于php如何获取服务器的返回状态,如:404 , 403 , 301 等,像这种状态码,用的全局变量哪个参数全部的内容,包括:php如何获取服务器的返回状态,如:404 , 403 , 301 等,像这种状态码,用的全局变量哪个参数、python如何获取服务器硬件状态信息,包括CPU温度、硬盘温度、主板电池电压、主机电源电压、CPU风扇转速、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)