Home >Backend Development >PHP Tutorial >Analyze how to obtain the current running environment through PHP functions to determine the execution logic_PHP tutorial
Generally, our operating environment is apache, of course some people use IIS environment
If we want to know what environment we are currently running in, then we only need to use the function php_sapi_name() to test
Perform comparison and judgment processing
Function: php_sapi_name();
The output result under the apache environment is "apache2handler";
The output result in cgi mode is "cgi-fcgi"
If you run it in command line mode, the output will be: "cli"