mirror of
https://github.com/php/doc-es.git
synced 2026-03-23 23:12:09 +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: PhilDaiguille Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
|
|
<refentry xml:id="function.php-uname" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>php_uname</refname>
|
|
<refpurpose>Devuelve información sobre el sistema operativo</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> devuelve una descripción del sistema
|
|
operativo en el que se ejecuta PHP. Es la misma cadena que se ve
|
|
al principio de <function>phpinfo</function>.
|
|
Si solo se desea conocer el nombre del sistema operativo, puede utilizarse
|
|
la constante <constant>PHP_OS</constant>, pero debe tenerse en cuenta que esta
|
|
constante contiene el nombre del sistema en el que PHP fue <emphasis>compilado</emphasis>.
|
|
</para>
|
|
<para>
|
|
En algunas antiguas plataformas Unix, no es posible
|
|
determinar las informaciones corrientes del SO, en cuyo caso esta función
|
|
se limita a devolver el nombre del SO en el que PHP fue compilado.
|
|
Esto solo ocurrirá si la biblioteca <literal>uname()</literal>
|
|
no existe o no funciona.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>mode</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
<parameter>mode</parameter> es un solo carácter que define
|
|
qué información se devolverá:
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>
|
|
<literal>'a'</literal>: Este es el valor por omisión. Devuelve las mismas
|
|
informaciones que los modos individuales
|
|
<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>
|
|
separadas por espacios.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
<literal>'s'</literal>: nombre del sistema operativo.
|
|
Por ejemplo, <literal>FreeBSD</literal>.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
<literal>'n'</literal>: nombre del host. Por ejemplo,
|
|
<literal>localhost.example.com</literal>.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
<literal>'r'</literal>: nombre de la versión. Por ejemplo,
|
|
<literal>5.1.2-RELEASE</literal>.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
<literal>'v'</literal>: información sobre la versión.
|
|
Varía enormemente según el sistema operativo.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
<literal>'m'</literal>: tipo de máquina.
|
|
Por ejemplo, <literal>i386</literal>.
|
|
</simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve la descripción, en forma de &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>
|
|
Levanta una excepción <classname>ValueError</classname> cuando
|
|
se especifica un <parameter>mode</parameter> inválido.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplos con <function>php_uname</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
echo php_uname();
|
|
echo PHP_OS;
|
|
|
|
/* Salidas posibles:
|
|
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 'El servidor se ejecuta en Windows !';
|
|
} else {
|
|
echo 'El servidor no se ejecuta en Windows !';
|
|
}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
Existen también algunas
|
|
<link linkend="language.constants.predefined">constantes PHP
|
|
predefinidas</link> relacionadas que pueden resultar útiles, por ejemplo:
|
|
<example>
|
|
<title>Ejemplos con algunas constantes relacionadas con el sistema</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
|
|
-->
|