Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php文件actionscript计算机属性ram处理器信息_Php_Actionscript_Ip - Fatal编程技术网

php文件actionscript计算机属性ram处理器信息

php文件actionscript计算机属性ram处理器信息,php,actionscript,ip,Php,Actionscript,Ip,我只是想知道php中是否有一种方法可以检索服务器的属性,如计算机名、ram、处理器信息 这些信息将加载到actionscript中 我以这种方式编写了一个php文件,以了解服务器的ip地址,就像在《网上》教程文章中所述的那样: <?php //Opening Tag, tell PHP server to interpret the following lines as php code $ip = $_SERVER['REMOTE_ADDR']; //Sets the ip varia

我只是想知道php中是否有一种方法可以检索服务器的属性,如计算机名、ram、处理器信息

这些信息将加载到actionscript中

我以这种方式编写了一个php文件,以了解服务器的ip地址,就像在《网上》教程文章中所述的那样:

<?php //Opening Tag, tell PHP server to interpret the following lines as php code 
$ip = $_SERVER['REMOTE_ADDR']; //Sets the ip variable, its value is a method that will get the user ip
echo $ip; //The echo keyword outputs the assigned string, in this case the ip variable 
?>

我已成功地将值回送或显示到闪存应用程序的ip地址。现在,我找不到的是如何知道服务器的计算机名、ram和处理器信息

这里有人知道php中显示我所需信息的代码吗

编辑: 谢谢你的快速回复

答案是这样的。我们必须使用exec命令。(考虑到尚未将安全功能配置为php或已关闭)

要知道电脑的名称,请使用pc

<?php
// outputs the username that owns the running php/httpd process
// (on a system with the "whoami" executable in the path)
echo exec('whoami');
?> 

对于PC的cpu和内存:

<?php

function GetProgCpuUsage($program)
 {
     if(!$program) return -1;

    $c_pid = exec("ps aux | grep ".$program." | grep -v grep | grep -v su | awk {'print $3'}");
     return $c_pid;
 }

function GetProgMemUsage($program)
 {
     if(!$program) return -1;

    $c_pid = exec("ps aux | grep ".$program." | grep -v grep | grep -v su | awk {'print $4'}");
     return $c_pid;
 }



    echo "CPU use of Program: ".GetProgCpuUsage($randomprogram)."%";
     echo "Memuse of Program: ".GetProgMemUsage($randomprogram)."%";

?>

在服务器中创建一个脚本,该脚本将获取其硬件信息并显示给您。之后,通过
actionscript
调用此脚本并显示信息

要获取硬件信息,需要系统命令。您必须使用
exec
函数来运行系统命令


要获取windows操作系统的系统信息,请使用此命令
systeminfo

否-但您可以调用程序并读取响应,或从提供此信息的伪文件系统读取响应-但这些是特定于操作系统的。(你没有说这是干什么用的操作系统)。看看你的代码,你似乎在试图重新发明轮子——这些东西大部分都是在开源许可下现成的——使用一种更合理的体系结构——例如,请参见“感谢你的这个想法”。我以前从未知道这一点。我要试试这种东西。