mirror of
https://github.com/php/doc-es.git
synced 2026-03-25 16:02:13 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@336081 c90b9560-bf6c-de11-be94-00142212c4b1
250 lines
6.3 KiB
XML
250 lines
6.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 8b5940cadeb4f1c8492f4a7f70743a2be807cf39 Maintainer: seros Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.stat">
|
|
<refnamediv>
|
|
<refname>stat</refname>
|
|
<refpurpose>Da información acerca de un fichero</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>stat</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Reúne las estadísticas del fichero nombrado por
|
|
<parameter>filename</parameter>. Si <parameter>filename</parameter> es un
|
|
enlace simbólico, las estadísticas son las del fichero mismo, no las del enlace simbólico.
|
|
</para>
|
|
<para>
|
|
<function>lstat</function> es idéntica a <function>stat</function>
|
|
excepto que está basada en el estado de los enlaces simbólicos.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>filename</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Ruta del fichero.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
<table>
|
|
<title>Formato del resultado de <function>stat</function> y
|
|
<function>fstat</function></title>
|
|
<tgroup cols="3">
|
|
<thead>
|
|
<row>
|
|
<entry>Numérico</entry>
|
|
<entry>Asociativo</entry>
|
|
<entry>Descripción</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>0</entry>
|
|
<entry>dev</entry>
|
|
<entry>número de dispositivo</entry>
|
|
</row>
|
|
<row>
|
|
<entry>1</entry>
|
|
<entry>ino</entry>
|
|
<entry>número de i-nodo *</entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry>mode</entry>
|
|
<entry>modo de protección del i-nodo</entry>
|
|
</row>
|
|
<row>
|
|
<entry>3</entry>
|
|
<entry>nlink</entry>
|
|
<entry>número de enlaces</entry>
|
|
</row>
|
|
<row>
|
|
<entry>4</entry>
|
|
<entry>uid</entry>
|
|
<entry>ID de usuario del propietario *</entry>
|
|
</row>
|
|
<row>
|
|
<entry>5</entry>
|
|
<entry>gid</entry>
|
|
<entry>ID de grupo del propietario *</entry>
|
|
</row>
|
|
<row>
|
|
<entry>6</entry>
|
|
<entry>rdev</entry>
|
|
<entry>tipo de dispositivo, si es un dispositivo i-nodo</entry>
|
|
</row>
|
|
<row>
|
|
<entry>7</entry>
|
|
<entry>size</entry>
|
|
<entry>tamaño en bytes</entry>
|
|
</row>
|
|
<row>
|
|
<entry>8</entry>
|
|
<entry>atime</entry>
|
|
<entry>momento del último acceso (tiempo Unix)</entry>
|
|
</row>
|
|
<row>
|
|
<entry>9</entry>
|
|
<entry>mtime</entry>
|
|
<entry>momento de la última modificación (tiempo Unix)</entry>
|
|
</row>
|
|
<row>
|
|
<entry>10</entry>
|
|
<entry>ctime</entry>
|
|
<entry>momento de la última modificación del i-nodo (tiempo Unix)</entry>
|
|
</row>
|
|
<row>
|
|
<entry>11</entry>
|
|
<entry>blksize</entry>
|
|
<entry>tamaño del bloque E/S del sistema de ficheros **</entry>
|
|
</row>
|
|
<row>
|
|
<entry>12</entry>
|
|
<entry>blocks</entry>
|
|
<entry>número de bloques de 512 bytes asignados **</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
* en Windows esto siempre será 0.
|
|
</para>
|
|
<para>
|
|
** Sólo válido para sistemas que soportan el tipo st_blksize type - otros
|
|
sistemas (p.ej. Windows) devuelven -1.
|
|
</para>
|
|
<para>
|
|
En caso de que se produzca un error, <function>stat</function> devuelve &false;.
|
|
</para>
|
|
&fs.file.32bit;
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Si falla, se emite un <constant>E_WARNING</constant>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo de <function>stat</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
/* Obtener las estadísticas de un fichero */
|
|
$estadísticas = stat('C:\php\php.exe');
|
|
|
|
/*
|
|
* Imprime el momento de acceso del fichero,
|
|
* esto es lo mismo que llamar a fileatime()
|
|
*/
|
|
echo 'Momento de acceso: ' . $estadísticas['atime'];
|
|
|
|
/*
|
|
* Imprime el momento de modificación del fichero,
|
|
* esto es lo mismo que llamar a filemtime()
|
|
*/
|
|
echo 'Momento de modificación: ' . $estadísticas['mtime'];
|
|
|
|
/* Imprime el número de dispositivo */
|
|
echo 'Número de dispositivo: ' . $estadísticas['dev'];
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Usar la información de <function>stat</function> junto con <function>touch</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
/* Obtener las estadísticas del fichero */
|
|
$estadísticas = @stat('C:\php\php.exe');
|
|
|
|
/* ¿Falló al obtener la información de stat? */
|
|
if(!$estadísticas) {
|
|
echo 'La llamada a stat() falló...';
|
|
} else {
|
|
/*
|
|
* Queremos que el tiempo de acceso sea 1 semana
|
|
* después que el tiempo de acceso actual.
|
|
*/
|
|
$atime = $estadísticas['atime'] + 604800;
|
|
|
|
/* Afectar el fichero */
|
|
if(!@touch('fichero.txt', time(), $atime)) {
|
|
echo 'Falló al afectar el fichero...';
|
|
} else {
|
|
echo 'touch() devolvió con éxito...';
|
|
}
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
¬e.filesystem-time-res;
|
|
¬e.clearstatcache;
|
|
&tip.fopen-wrapper.stat;
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>lstat</function></member>
|
|
<member><function>fstat</function></member>
|
|
<member><function>filemtime</function></member>
|
|
<member><function>filegroup</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
|
|
-->
|