Home  >  Article  >  Backend Development  >  Analyze how to obtain the current running environment through PHP functions to determine the execution logic (tips)_PHP tutorial

Analyze how to obtain the current running environment through PHP functions to determine the execution logic (tips)_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:03:37981browse

Generally, our running environment is apache, of course some people use IIS environment
If we want to know what our current running environment is, 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";
In cgi mode The output result is "cgi-fcgi"
If it is run in command line mode, the output result is: "cli"


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327843.htmlTechArticleGenerally, our operating environment is apache. Of course, some people use IIS environment. If we want to know What is the environment we are currently running in, then we only need to use the function...
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