是否可以使用PHP识别Linux 32或64位?
phpinfo()
Run Code Online (Sandbox Code Playgroud)
回报
Linux infong 2.4 #1 SMP Mon Oct 10 09:34:36 UTC 2011 i686 GNU/Linux
Run Code Online (Sandbox Code Playgroud)
它是共享主机,所以我不能使用命令行.
Kon*_*nel 22
做一个简单的测试:
var_dump(is_int( 9223372036854775807 ));
Run Code Online (Sandbox Code Playgroud)
对于32位环境,它将返回false,因为此数字远大于最大32位整数.对于64位环境,它将返回true.
或者在评论中使用PHP_INT_MAX作为马里奥.
echo (PHP_INT_MAX == 2147483647)?'32-bit':'64-bit';
Run Code Online (Sandbox Code Playgroud)
或者使用PHP_INT_SIZE:
echo (PHP_INT_SIZE * 8) . '-bit';
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4074 次 |
| 最近记录: |