mirror of
https://github.com/php/doc-fr.git
synced 2026-03-24 07:02:06 +01:00
219 lines
5.9 KiB
XML
219 lines
5.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 03db4883c52dfbe6be059d915a159e3a1dd9e7cb Maintainer: dams Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
|
|
<refentry xml:id="function.php-uname" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>php_uname</refname>
|
|
<refpurpose>Retourne les informations sur le système d'exploitation</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>php_uname</methodname>
|
|
<methodparam choice="opt"><type>string</type><parameter>mode</parameter><initializer>"a"</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>php_uname</function> retourne une description sur le système
|
|
d'exploitation sur lequel tourne PHP. C'est la même chaîne que celle
|
|
que l'on voit en haut du <function>phpinfo</function>.
|
|
Pour juste savoir le nom du système d'exploitation, il est préférable
|
|
d'utiliser la constante <constant>PHP_OS</constant>, en gardant à l'esprit que cette
|
|
constante contient le nom du système sur lequel PHP a été <emphasis>compilé</emphasis>.
|
|
</para>
|
|
<para>
|
|
Sur certaines vieilles plate-formes Unix, il n'est pas possible de
|
|
déterminer les informations courantes de l'OS, auquel cas cette fonction
|
|
se contente de retourner le nom de l'OS sur lequel PHP a été compilé.
|
|
Cela n'arrivera que si la bibliothèque <literal>uname()</literal>
|
|
n'existe pas ou ne fonctionne pas.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>mode</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
<parameter>mode</parameter> est un seul caractère qui définit
|
|
quelles seront les informations à retourner :
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>
|
|
<literal>'a'</literal> : C'est la valeur par défaut. Retourne les mêmes
|
|
informations que les modes individuels
|
|
<simplelist type="inline">
|
|
<member><literal>'s'</literal></member>
|
|
<member><literal>'n'</literal></member>
|
|
<member><literal>'r'</literal></member>
|
|
<member><literal>'v'</literal></member>
|
|
<member><literal>'m'</literal></member>
|
|
</simplelist>
|
|
séparées par des espaces.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
<literal>'s'</literal>: nom du système d'exploitation.
|
|
Par exemple, <literal>FreeBSD</literal>.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
<literal>'n'</literal>: nom de l'hôte. Par exemple,
|
|
<literal>localhost.example.com</literal>.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
<literal>'r'</literal>: nom de la version. Par exemple,
|
|
<literal>5.1.2-RELEASE</literal>.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
<literal>'v'</literal>: information sur la version.
|
|
Varie énormément suivant le système d'exploitation.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
<literal>'m'</literal>: type de la machine.
|
|
Par exemple, <literal>i386</literal>.
|
|
</simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retourne la description, sous la forme d'une &string;.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.4.0</entry>
|
|
<entry>
|
|
Lève une exception <classname>ValueError</classname> lorsqu'un
|
|
<parameter>mode</parameter> invalide est spécifié.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemples avec <function>php_uname</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
echo php_uname();
|
|
echo PHP_OS;
|
|
|
|
/* Affichages possibles :
|
|
Linux localhost 2.4.21-0.13mdk #1 Fri Mar 14 15:08:06 EST 2003 i686
|
|
Linux
|
|
|
|
FreeBSD localhost 3.2-RELEASE #15: Mon Dec 17 08:46:02 GMT 2001
|
|
FreeBSD
|
|
|
|
Windows NT XN1 5.1 build 2600
|
|
WINNT
|
|
*/
|
|
|
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
|
echo 'Le serveur tourne sous Windows !';
|
|
} else {
|
|
echo 'Le serveur ne tourne pas sous Windows !';
|
|
}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
Il existe aussi des
|
|
<link linkend="language.constants.predefined">constantes PHP
|
|
pré-définies</link> liées qui peuvent s'avérer utiles, par exemple :
|
|
<example>
|
|
<title>Exemples avec quelques constantes liées au système</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// *nix
|
|
echo DIRECTORY_SEPARATOR; // /
|
|
echo PHP_SHLIB_SUFFIX; // so
|
|
echo PATH_SEPARATOR; // :
|
|
|
|
// Win*
|
|
echo DIRECTORY_SEPARATOR; // \
|
|
echo PHP_SHLIB_SUFFIX; // dll
|
|
echo PATH_SEPARATOR; // ;
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>phpversion</function></member>
|
|
<member><function>php_sapi_name</function></member>
|
|
<member><function>phpinfo</function></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
|
|
-->
|