Home > php教程 > PHP源码 > body text

php查看运行php环境函数php_sapi_name

WBOY
Release: 2016-06-08 17:21:47
Original
1519 people have browsed it

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字符了。

Related labels:
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
Popular Recommendations
Popular Tutorials
More>
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!