1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-24 07:42:22 +01:00
Files
archived-doc-ru/reference/info/functions/php-sapi-name.xml
Sergey Panteleev 6d43fd64d7 Исправление форматирования
[skip-spellcheck]
[skip-lint]
2022-12-27 03:42:36 +03:00

122 lines
3.9 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 8dd14a886c7e954cef181c374b6f05cc7149e643 Maintainer: tmn Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.php-sapi-name" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>php_sapi_name</refname>
<refpurpose>
Возвращает тип интерфейса между веб-сервером и PHP
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>string</type><type>false</type></type><methodname>php_sapi_name</methodname>
<void/>
</methodsynopsis>
<simpara>
Возвращает строку в нижнем регистре, содержащую описание типа интерфейса
(Server API, SAPI), который использует PHP. Например, в CLI PHP эта строка
будет "cli", в то время как с Apache может быть несколько разных значений
в зависимости от конкретного SAPI. Возможные значение приведены ниже.
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Возвращает тип интерфейса в виде строки в нижнем регистре&return.falseforfailure;.
</para>
<para>
Возможные возвращаемые значения (список может быть неполным):
<literal>apache</literal>,
<literal>apache2handler</literal>,
<literal>cgi</literal> (до PHP 5.3),
<literal>cgi-fcgi</literal>, <literal>cli</literal>, <literal>cli-server</literal>,
<literal>embed</literal>, <literal>fpm-fcgi</literal>,
<literal>litespeed</literal>,
<literal>phpdbg</literal>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Пример использования <function>php_sapi_name</function></title>
<para>
В этом примере проверяется подстрока <literal>cgi</literal>, так как это также
может быть <literal>cgi-fcgi</literal>.
</para>
<programlisting role="php">
<![CDATA[
<?php
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Вы используете CGI PHP\n";
} else {
echo "Вы используете не CGI PHP\n";
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<title>Альтернативный вариант</title>
<para>
Константа PHP <constant>PHP_SAPI</constant> хранит то же значение, что и
<function>php_sapi_name</function>.
</para>
</note>
<tip>
<title>Важный аспект</title>
<para>
Имя <acronym>SAPI</acronym> может определиться неточно, так как, например,
в случае с <literal>apache</literal> интерфейс может быть определён как
<literal>apache2handler</literal>.
</para>
</tip>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="reserved.constants.core">PHP_SAPI</link></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->