mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-29 04:12:21 +02:00
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@270813 c90b9560-bf6c-de11-be94-00142212c4b1
282 lines
6.8 KiB
XML
282 lines
6.8 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.24 $ -->
|
|
<!-- EN-Revision: 1.24 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.stat">
|
|
<refnamediv>
|
|
<refname>stat</refname>
|
|
<refpurpose>Renvoie les informations à propos d'un fichier</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>stat</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Renvoie les informations à propos du fichier <parameter>filename</parameter>.
|
|
Si <parameter>filename</parameter> est un lien symbolique, les informations
|
|
proviennent du fichier lui-même, et non du lien symbolique.
|
|
</para>
|
|
<para>
|
|
<function>lstat</function> est identique à
|
|
<function>stat</function> sauf que les informations seront alors basées
|
|
sur le lien symbolique.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>filename</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Le chemin vers le fichier.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
<table>
|
|
<title>Format du résultat de <function>stat</function> et
|
|
<function>fstat</function></title>
|
|
<tgroup cols="3">
|
|
<thead>
|
|
<row>
|
|
<entry>Numéro</entry>
|
|
<entry>Nom (depuis PHP 4.0.6)</entry>
|
|
<entry>Description</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>0</entry>
|
|
<entry>dev</entry>
|
|
<entry>volume</entry>
|
|
</row>
|
|
<row>
|
|
<entry>1</entry>
|
|
<entry>ino</entry>
|
|
<entry>Numéro d'inode (*)</entry>
|
|
</row>
|
|
<row>
|
|
<entry>2</entry>
|
|
<entry>mode</entry>
|
|
<entry>droit d'accès à l'inode</entry>
|
|
</row>
|
|
<row>
|
|
<entry>3</entry>
|
|
<entry>nlink</entry>
|
|
<entry>nombre de liens</entry>
|
|
</row>
|
|
<row>
|
|
<entry>4</entry>
|
|
<entry>uid</entry>
|
|
<entry>userid du propriétaire (*)</entry>
|
|
</row>
|
|
<row>
|
|
<entry>5</entry>
|
|
<entry>gid</entry>
|
|
<entry>groupid du propriétaire (*)</entry>
|
|
</row>
|
|
<row>
|
|
<entry>6</entry>
|
|
<entry>rdev</entry>
|
|
<entry>type du volume, si le volume est une inode</entry>
|
|
</row>
|
|
<row>
|
|
<entry>7</entry>
|
|
<entry>size</entry>
|
|
<entry>taille en octets</entry>
|
|
</row>
|
|
<row>
|
|
<entry>8</entry>
|
|
<entry>atime</entry>
|
|
<entry>date de dernier accès (Unix timestamp)</entry>
|
|
</row>
|
|
<row>
|
|
<entry>9</entry>
|
|
<entry>mtime</entry>
|
|
<entry>date de dernière modification (Unix timestamp)</entry>
|
|
</row>
|
|
<row>
|
|
<entry>10</entry>
|
|
<entry>ctime</entry>
|
|
<entry>date de dernier changement d'inode (Unix timestamp)</entry>
|
|
</row>
|
|
<row>
|
|
<entry>11</entry>
|
|
<entry>blksize</entry>
|
|
<entry>taille de bloc (**)</entry>
|
|
</row>
|
|
<row>
|
|
<entry>12</entry>
|
|
<entry>blocks</entry>
|
|
<entry>nombre de blocs alloués (**)</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
* - Sous Windows, vaudra toujours 0.
|
|
</para>
|
|
<para>
|
|
* - uniquement sur les systèmes qui supportent le type <literal>st_blksize</literal>.
|
|
Les autres systèmes (e.g. Windows) retournent -1.
|
|
</para>
|
|
<para>
|
|
En cas d'erreur, <function>stat</function> retourne &false;.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Si une erreur survient, une alerte de type
|
|
<constant>E_WARNING</constant> sera émise.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>4.0.6</entry>
|
|
<entry>
|
|
En plus de retourner ces attributs dans un tableau numérique,
|
|
ils peuvent être lus à l'aide de leurs indices, tels que notés
|
|
près de chacun des paramètres
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>stat</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
/* Récupération des informations */
|
|
$stat = stat('C:\php\php.exe');
|
|
|
|
/*
|
|
* Affichage de la date et heure de l'accès à ce fichier,
|
|
* identique à l'appel à la fonction fileatime()
|
|
*/
|
|
echo 'Date et heure d\'accès : ' . $stat['atime'];
|
|
|
|
/*
|
|
* Affiche de la date et heure de modification du fichier,
|
|
* identique à l'appel à la fonction filemtime()
|
|
*/
|
|
echo 'Date et heure de modification : ' . $stat['mtime'];
|
|
|
|
/* Affichage du numéro du device */
|
|
echo 'Numéro du Device : ' . $stat['dev'];
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Utilisation des informations issues de <function>stat</function>
|
|
conjointement avec la fonction <function>touch</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
/* Récupération des informations issues de la fonction stat */
|
|
$stat = @stat('C:\php\php.exe');
|
|
|
|
/* L'accès aux informations a-t-il échoué ? */
|
|
if(!$stat)
|
|
{
|
|
echo 'L\'appel à stat() a échoué...';
|
|
}
|
|
else
|
|
{
|
|
/*
|
|
* Nous voulons que la date et heure d'accès soit d'une semaine avant la date courante.
|
|
*/
|
|
$atime = $stat['atime'] + 604800;
|
|
|
|
/* Touchons le fichier ! */
|
|
if(!@touch('some_file.txt', time(), $atime))
|
|
{
|
|
echo 'Échec lors de l\'appel à la fonction touch()...';
|
|
}
|
|
else
|
|
{
|
|
echo 'La fonction touch() a réussi...';
|
|
}
|
|
}
|
|
?>
|
|
]]>
|
|
</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:"../../../../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
|
|
--> |