Home > Backend Development > PHP Tutorial > php_uname function

php_uname function

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-29 09:13:08
Original
3966 people have browsed it

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>
Copy after login
').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.

Related labels:
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template