Home >Backend Development >PHP Tutorial >Analyze how to obtain the current running environment through PHP functions to determine the execution logic_PHP tutorial

Analyze how to obtain the current running environment through PHP functions to determine the execution logic_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:16:56755browse

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"

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/372115.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