可能的值:PHP_OS

发布于 2024-07-17 21:33:44 字数 408 浏览 4 评论 0原文

有没有地方可以找到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

初见终念 2024-07-24 21:33:45

PHP 通过 uname, Windows 除外 (WINNT)网络软件(网络软件 。 请参阅维基百科,了解您的问题中未提及的值的非详尽列表:

  • CYGWIN_NT-5.1
  • IRIX64
  • SunOS
  • HP-UX
  • OpenBSD(维基百科中没有)

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:

  • CYGWIN_NT-5.1
  • IRIX64
  • SunOS
  • HP-UX
  • OpenBSD (not in Wikipedia)
请恋爱 2024-07-24 21:33:45

我认为进行“需求检查”的更好解决方案是实际使用您需要知道正常工作的东西并看看会发生什么。

例如,有目录分隔符常量、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?

左耳近心 2024-07-24 21:33:45

对于非 Unix 操作系统来说,php_uname("s") 似乎是一个好的开始,因为它在我看来就像 uname("s")php_uname("s") 在 Unix 系统和 posix 子系统上是相同的,例如 Cygwin、Mingw、UWin、EMX+GCC 和 MKS。 以下是不符合 Posix 标准但运行 PHP 的操作系统列表。

操作系统

  • OS/2 Warp
  • eComStation
  • RISC 操作系统
  • Windows XP 64 位

请记住,这根本不是用于浏览器检测,而是根路径检测,目录分隔符可能是也可能不是 \/、EOL 和其他一些东西。

根路径示例

  • Unix\linux\Mac OS X: /
  • OS/2: C:\
  • Amiga: dh0:

it seems like the php_uname("s") for non-Unix OSes would be a good start, since it looks to me like uname("s") and php_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

  • OS/2 Warp
  • eComStation
  • RISC OS
  • Windows XP 64-bit

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

  • Unix\linux\Mac OS X: /
  • OS/2: C:\
  • Amiga: dh0:
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文