Home >Backend Development >PHP Tutorial >php_uname function

php_uname function

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-29 09:13:083961browse

1. Description

 php_uname — Returns information about the system running PHP.
Prototype: string php_uname ([ string $mode = “a” ] ). Returns a description of the operating system running php, which is the same string output at the top of phpinfo(). If you just want to get the name of the operating system. Consider using the constant PHP_OS, but be aware that this constant will contain the name of the operating system when PHP was built.

2. Parameter

 mode is a single character used to define what information is to be returned:

  • ‘a’: This is the default. Contains all patterns in the sequence "s n r v m".
  • ’s’: operating system name. For example: FreeBSD.
  • ‘n’: hostname. For example: localhost.example.com.
  • ‘r’: version name, for example: 5.1.2-RELEASE.
  • ‘v’: version information. There are big differences between operating systems.
  • ‘m’: machine type. For example: i386.

3. Example

<code><span><?php</span><span>$sys_info</span> = php_uname() . <span>"\n"</span>;

<span>if</span>(strtolower(substr(<span>$sys_info</span>,<span>0</span>,<span>5</span>)) == <span>"linux"</span>) {
    <span>echo</span><span>"this is a linux system.\n"</span>;
}

<span>echo</span><span>"Host: "</span> . php_uname(<span>'n'</span>) . <span>"\n"</span>;

<span>?></span></code>
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above has introduced the php_uname function, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn