如何使用 php 查明共享主机运行的是 32 位还是 64 位
是否可以使用 PHP 识别 Linux 32 位或 64 位?
phpinfo()
返回
Linux infong 2.4 #1 SMP Mon Oct 10 09:34:36 UTC 2011 i686 GNU/Linux
它是共享托管,因此我无法使用命令行。
Is it possible to identify Linux 32 or 64 bit, using PHP?
phpinfo()
returns
Linux infong 2.4 #1 SMP Mon Oct 10 09:34:36 UTC 2011 i686 GNU/Linux
It's shared hosting so I cant use command line.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
做一个简单的测试:
对于 32 位环境,它将返回 false,因为该数字比最大 32 位整数大得多。对于 64 位环境它将返回 true。
或者按照 mario 在评论中建议的方式使用 PHP_INT_MAX 。
或者使用 PHP_INT_SIZE:
Do a simple test:
For 32-bit environment it will return false as this number is much bigger that maximum 32-bit integer. For 64-bit environment it will return true.
Or use PHP_INT_MAX as mario suggested in comments.
Or use PHP_INT_SIZE: