I am using the WinXP, but upload the server is Linux, each upload always need to change the configuration file, there are some other things,
Now, by judging the type of the current server to decide what kind of program to perform, how does PHP determine what type of server it is in?
PHP has many system predefined variables, by which they can simply judge whether the system is windows or *unix
The related functions or predefined variables are as follows
Copy Code code as follows:
Php_uname ();
Php_os
Directory_separator
Php_shlib_suffix
Path_separator
Specific procedures:
Copy Code code as follows:
?
if (path_separator== ': ') echo ' Linux ';
else echo ' Windows ';
?>
Or
Copy Code code as follows:
<?php
Echo php_uname ();
Echo Php_os;
/* Some possible outputs:
Linux localhost 2.4.21-0.13mdk #1 Fri Mar 15:08:06 EST 2003 i686
Linux
Fre EBSD localhost 3.2-release #15: Mon Dec 08:46:02 GMT 2001
FreeBSD
Windows NT XN1 5.1 build 2600
WINNT br>*/
if (Strtoupper (substr (php_os, 0, 3)) = = = ' WIN ') {
echo ' is a server using windows! ';
} else {
echo ' is a server not using windows! ';
}
?>