I'm not sure about my platform,
can I diagnose it programatica开发者_开发知识库lly?
print out the max int value
echo PHP_INT_MAX;
output on 32bit hardware
2147483647
output on 64bit hardware
9223372036854775807
If you want to do it using PHP, phpinfo(INFO_GENERAL)
should show your server's information.
If you're referring to the OS (not the hardware) then you should be able to get this info from php_uname.
If you want to know whether the hardware is 32 or 64-bit then on Linux you should be able to get this info from /proc/cpuinfo, on Windows you will have to use the Win32 API. Though it's quite possible that this will not work on shared hosting...
BTW You might want to check out the source code of phpSysInfo to see how you can get hardware information.
You will probably want to find it buried in one of the predefined variables.
Another good place to look would be the Windows-only services.
精彩评论