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

PHP determines the type of server operating system_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:25:031073browse

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...
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