我用这个代码来理解一些访问者( 客户) 的信息。 它一直在 Xampp 上的虚拟服务器上运行, 但我无法运行主服务器( 主机) 。 我看到的是空白页面 。
$info = system( ipconfig /all );
echo $info;
我用这个代码来理解一些访问者( 客户) 的信息。 它一直在 Xampp 上的虚拟服务器上运行, 但我无法运行主服务器( 主机) 。 我看到的是空白页面 。
$info = system( ipconfig /all );
echo $info;
这可能帮助你
<强 > 服务器 IP
您可以从$_SERVER[SERVER_ADR]
获得服务器IP地址。
<强度> 密钥 IP 地址
您可以从 $_SERVER[REMOTE_ADD]
获得客户端 IP
< 加强 > 编辑 : 您在评论中询问如何获取外部命令的输出 - 一种方法是使用回icks, 例如 。
$ipAddress=$_SERVER[ REMOTE_ADDR ];
$macAddr=false;
#run the external command, break output into lines
$arp=`arp -a $ipAddress`;
$lines=explode("
", $arp);
#look for the output line describing our IP address
foreach($lines as $line)
{
$cols=preg_split( /s+/ , trim($line));
if ($cols[0]==$ipAddress)
{
$macAddr=$cols[1];
}
}
<强> 但如果客户端不在局域网上呢?
除非客户自愿提供信息并通过其他方式传递,否则你运气不好。见Peter G Macs关于使用Javashamp的建议。
也可以尝试跟随命令
<?php
// http://www.php.net/manual/en/function.exec.php#85930
$_ = null;
// If you care about the return value, use this:
passthru("C:\WINDOWS\system32\cmd.exe /c custom.bat",$_);
header( Content-Type: text/plain );
echo $_;
// if you don t care, just use this:
$_ = exec("C:\WINDOWS\system32\cmd.exe /c custom.bat");
?>
这将只获取 < engen@ em> serverers IP 信息, 而不是客户端信息。 因为您正在本地 PC 上运行代码, 您将会看到本地信息( 这将与服务器信息相同 ) 。
另外,如果主机服务器正在运行 Linux, 命令将是 ifconfig
, 但是仍然只能获取服务器信息 。
既然你澄清了服务器基于Linux, Linux的正确指令就是
/sbin/ifconfig -a
返回的数据将看起来略有不同
eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: 0000::000:0000:0000:0000/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:14141910 errors:0 dropped:0 overruns:0 frame:0
TX packets:6532919 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4462743134 (4.4 GB) TX bytes:1340503018 (1.3 GB)
Interrupt:22 Memory:f6ae0000-f6b00000
I am trying to find out the difference between difference service account types. I tumbled upon this question. The answer was because it has powerful access to local resources, and Network Service ...
Does anyone know how to programatically detect that a Windows server is part of a cluster? Further, is it possible to detect that the server is the active or passive node? [Edit] And detect it from ...
I ve read Get File Icon used by Shell and the other similar posts - and already use SHFileInfo to get the associated icon for any given extension, and that works great. However, Outlook uses ".msg" ...
How can I create an empty file at the DOS/Windows command-line? I tried: copy nul > file.txt But it always displays that a file was copied. Is there another method in the standard cmd? It should ...
I know about the GetLastInputInfo method but that would only give me the duration since last user input - keyboard or mouse. If a user input was last received 10 minutes ago, that wouldn t mean the ...
My application creates a thread and that runs in the background all the time. I can only terminate the thread manually, not from within the thread callback function. At the moment I am using ...
Yes, I know, the archive bit is evil. That being said, is there support for querying it with find , and modifying it with chmod ? My googling has turned up nothing......
I built a Java application that is delivered on USB sticks. To ensure compatibility, I ship an appropriate JVM on the sticks. I made an EXE that simply invokes this JVM with the application jar. Now ...