PHP函数:php_sapi_name

php_sapi_name()  - 返回 web 服务器和 PHP 之间的接口类型。

SAPI(Server Application Programming Interface)服务器应用程序编程接口,即PHP与其他应用交互的接口,PHP脚本要执行有很多方式,通过Web服务器,或者直接在命令行下,也可以嵌入在其他程序中。

返回值等同于PHP常量:PHP_SAPI

说明:

php_sapi_name ( void ) : string

返回描述 PHP 所使用的接口类型(the Server API, SAPI)的小写字符串。 例如,CLI 的 PHP 下这个字符串会是 "cli",Apache 下可能会有几个不同的值,取决于具体使用的 SAPI。

参数:

返回值:

返回接口类型的小写字符串。

尽管不够全面,可能返回的值包括了 aolserverapache、 apache2filterapache2handler、 caudiumcgi (直到 PHP 5.3), cgi-fcgicli、 cli-server、 continuityembedfpm-fcgi、 isapilitespeed、 milternsapi、 phttpdpi3webroxen、 thttpdtux 和 webjames

 

参考链接:

手册

Enjoy it !

原文地址:https://www.cnblogs.com/daizhongxing/p/12667760.html