php_sapi_name函数是一个可以返回php所运行的web服务器环境的字符串,下面我们来看两个关于php_sapi_name函数测试出php运行环境的例子。
<script>ec(2);</script>
代码:
echo php_sapi_name();
?>
在apache环境下面输出的结果是“apache2handler”;
在cgi模式下输出的结果是“cgi-fcgi”
要是在命令行模式下面运行的话,那么输出的结果是:”cli”
如果在nginx中运行就是 nginx字符了。
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