解析如何通过PHP函数获取当前运行的环境 来进行判断执行逻辑_PHP教程

WBOY
Release: 2016-07-20 11:16:56
Original
673 people have browsed it

一般情况下,我们的运行环境是 apache,当然也有些人是用IIS环境的
我们要是想知道我们目前运行的环境是什么的话,那我们只需要用函数php_sapi_name()来测试
进行比较判断处理
函数:php_sapi_name();
在apache环境下面输出的结果是“apache2handler”;
在cgi模式下输出的结果是“cgi-fcgi”
要是在命令行模式下面运行的话,那么输出的结果是:”cli”

www.bkjia.com true http://www.bkjia.com/PHPjc/372115.html TechArticle 一般情况下,我们的运行环境是 apache,当然也有些人是用IIS环境的 我们要是想知道我们目前运行的环境是什么的话,那我们只需要用函数...
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!