How PHP determines whether the current operating system is Linux or Windows

Source: Internet
Author: User

Php_uname () The meaning of this function is to return information about the system currently running in PHP, and the following is a detailed description of this function:

    1. /* * function: Returns information on the system currently running in PHP * @param string $mode  *       ' a ':  returns all information *       ' s ':  name of the operating system, such as FreeBSD *       ' n ':  the name of the host, such as cnscn.org *       ' R ':  version name, such as 5.1.2-release *       ' V ':  operating       System version number * */ string Php_uname ([string$mode

Examples of Use:

    1. Echo Php_uname  echophp_uname

Php_os PHP comes with a built-in constant, which returns the server -side operating system identifier, value (WINNT,WIN32, etc.)

Examples of Use:

    1. Echo Strtoupper (substr(php_os

Directory_separator PHP comes with a built-in constant that displays the system delimiter command, without any definition and inclusion to use directly. As we all know, the path delimiter under Windows is \ (and of course, it works on some systems), and the path delimiter on Linux is/,directory_separator the meaning of this constant exists is that different separators are displayed depending on the operating system.

An example of using Directory_separator to determine the operating system type is as follows:

    1. Echo

Path_separator is a constant, in the Linux system is a ":" Number, Windows is a ";" No.

An example of using Path_separator to determine the operating system type is as follows:

    1. Echo

How PHP determines whether the current operating system is Linux or Windows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.