PHP
downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

php_uname> <php_logo_guid
Last updated: Fri, 09 Jan 2009

view this page in

php_sapi_name

(PHP 4 >= 4.0.1, PHP 5)

php_sapi_nameウェブサーバと PHP の間のインターフェイスの型を返す

説明

string php_sapi_name ( void )

Web サーバと PHP (サーバ API、SAPI) の間のインターフェイスの型を小文字の文字列で返します。 CGI 版の PHP ではこの文字列は「cgi」となり、Apache の mod_php 版ではこの文字列は「apache」となるといったようになります。

返り値

インターフェイスの型を小文字の文字列で返します。

例1 php_sapi_name() の例

<?php
$sapi_type 
php_sapi_name();
if (
substr($sapi_type03) == 'cgi') {
    echo 
"CGI 版の PHP を使用しています\n";
} else {
    echo 
"CGI 版の PHP を使用していません\n";
}
?>

参考



add a note add a note User Contributed Notes
php_sapi_name
Ysangkok
27-Aug-2008 02:34
This function can also return "cli" if PHP was launched from CLI. Useful if one wants to behave differently when running in console.

php_uname> <php_logo_guid
Last updated: Fri, 09 Jan 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites