Home > Backend Development > PHP Tutorial > PHP determines the type of server operating system_PHP tutorial

PHP determines the type of server operating system_PHP tutorial

WBOY
Release: 2016-07-13 10:25:03
Original
1121 people have browsed it

1: PHP has many system predefined variables. By judging them, you can easily determine whether the server system is windows or *unix. The relevant functions or predefined variables are as follows:
php_uname(), PHP_OS, DIRECTORY_SEPARATOR, PHP_SHLIB_SUFFIX ,PATH_SEPARATOR

Two: Example:

Copy code The code is as follows:

If(strtolower(substr(PHP_OS, 0, 3)) == 'win'){
echo 'windows';
}else{
echo 'linux';
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825235.htmlTechArticle1: PHP has many system predefined variables. By judging them, you can easily determine whether the server system is windows or *unix. , the relevant functions or predefined variables are as follows: php_una...
Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template