可能的值:PHP_OS
有没有地方可以找到 PHP 预定义常量 PHP_OS
的可能值列表? 我想使用该值进行系统要求检查,但需要知道不同的操作系统如何在此变量中命名。
通过一些搜索,到目前为止,我已经编译了以下列表:
- CYGWIN_NT-5.1
- Darwin
- FreeBSD
- HP-UX
- IRIX64
- Linux
- NetBSD
- OpenBSD
- SunOS
- Unix
- WIN32
- WINNT
- Windows
如果有人有更完整的列表,或者知道任何其他值,我很乐意听到他们的声音!
Is there a place to find a list of the possible values for the PHP predefined constant PHP_OS
? I'd like to use this value for a system requirements check, but need to know how different operating systems are named in this variable.
Through some searching, so far I've compiled the following list:
- CYGWIN_NT-5.1
- Darwin
- FreeBSD
- HP-UX
- IRIX64
- Linux
- NetBSD
- OpenBSD
- SunOS
- Unix
- WIN32
- WINNT
- Windows
If anyone has a more complete list, or knows of any additional values I'd love to hear them!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
PHP 通过 uname, Windows 除外 (
WINNT
) 和网络软件(网络软件
) 。 请参阅维基百科,了解您的问题中未提及的值的非详尽列表:PHP passes through the uname, except on Windows (
WINNT
) and Netware (Netware
). See Wikipedia for a non-exhaustive list of values not mentioned in your question:我认为进行“需求检查”的更好解决方案是实际使用您需要知道正常工作的东西并看看会发生什么。
例如,有目录分隔符常量、realpath() 等函数来处理不同操作系统上的目录。
具体来说,你想做什么?
I think a better solution to do a 'requirement check' would be to actually use things that you need to know work properly and see what happens.
For example, there are constants for directory separators, functions like realpath(), etc to deal with directories on different operating systems.
What, specifically, are you trying to do?
对于非 Unix 操作系统来说,
php_uname("s")
似乎是一个好的开始,因为它在我看来就像uname("s")
和php_uname("s")
在 Unix 系统和 posix 子系统上是相同的,例如 Cygwin、Mingw、UWin、EMX+GCC 和 MKS。 以下是不符合 Posix 标准但运行 PHP 的操作系统列表。操作系统
请记住,这根本不是用于浏览器检测,而是根路径检测,目录分隔符可能是也可能不是
\
和/
、EOL 和其他一些东西。根路径示例
/
C:\
dh0:
it seems like the
php_uname("s")
for non-Unix OSes would be a good start, since it looks to me likeuname("s")
andphp_uname("s")
are the same on Unix systems and posix sub systems, such as Cygwin, Mingw, UWin, EMX+GCC, and MKS. Below is a list of OSes that are not Posix-compliant out of the box and that run PHP.OS
Keep in mind, this is not at all for Browser detection, but root path detecting, directory separators that may or may not be
\
and/
, EOL, and a few other things.Examples of root paths
/
C:\
dh0: