mirror of
https://github.com/php/doc-fr.git
synced 2026-03-24 07:02:06 +01:00
170 lines
4.4 KiB
XML
170 lines
4.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 0c9c2dd669fe9395eaa73d487fbd160f9057429a Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xml:id="function.realpath" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>realpath</refname>
|
|
<refpurpose>Retourne le chemin canonique absolu</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>string</type><type>false</type></type><methodname>realpath</methodname>
|
|
<methodparam><type>string</type><parameter>path</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>realpath</function> résout tous les liens symboliques, et
|
|
remplace toutes les références <literal>/./</literal>, <literal>/../</literal>
|
|
et <literal>/</literal> de <parameter>path</parameter> puis retourne
|
|
le chemin canonique absolu ainsi trouvé.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>path</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Le chemin à vérifier.
|
|
<note>
|
|
<para>
|
|
Un chemin d'accès doit être fourni, la valeur peut être une chaîne de caractères vide.
|
|
Dans ces cas, la valeur est interprétée comme étant le dossier courant.
|
|
</para>
|
|
</note>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retourne le chemin canonique absolu
|
|
ainsi trouvé. Le résultat ne contient aucun lien symbolique,
|
|
<literal>/./</literal> ou <literal>/../</literal>. Les délimiteurs
|
|
de fin comme <literal>\</literal> et <literal>/</literal> sont également supprimés.
|
|
</para>
|
|
<para>
|
|
<function>realpath</function> retourne &false; si une erreur survient, p. ex.
|
|
si le fichier n'existe pas.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Le script qui s'exécute doit avoir les permissions en exécution
|
|
sur tous les dossiers de la structure, sinon, la fonction
|
|
<function>realpath</function> retourne &false;.
|
|
</para>
|
|
</note>
|
|
<note>
|
|
<para>
|
|
Pour les systèmes de fichiers insensibles à la casse,
|
|
<function>realpath</function> peut ou non normaliser la casse des
|
|
caractères.
|
|
</para>
|
|
</note>
|
|
<note>
|
|
<para>
|
|
La fonction <function>realpath</function> ne fonctionnera pas pour un
|
|
fichier qui se trouve à l'intérieur d'un phar car ce chemin serait un
|
|
chemin d'accès virtuel, pas un vrai.
|
|
</para>
|
|
</note>
|
|
<note>
|
|
<para>
|
|
Sur Windows, les jonctions et les liens symboliques aux dossiers sont
|
|
uniquement étendus d'un niveau.
|
|
</para>
|
|
</note>
|
|
&fs.file.32bit;
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>realpath</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
chdir('/var/www/');
|
|
echo realpath('./../../etc/passwd') . PHP_EOL;
|
|
|
|
echo realpath('/tmp/') . PHP_EOL;
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
/etc/passwd
|
|
/tmp
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
<example>
|
|
<title>Exemple avec <function>realpath</function> sous Windows</title>
|
|
<para>
|
|
Sous Windows, <function>realpath</function> changera les chemins de style Unix
|
|
en chemins de style Windows.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
echo realpath('/windows/system32'), PHP_EOL;
|
|
|
|
echo realpath('C:\Program Files\\'), PHP_EOL;
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
C:\WINDOWS\System32
|
|
C:\Program Files
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>basename</function></member>
|
|
<member><function>dirname</function></member>
|
|
<member><function>pathinfo</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
|
|
-->
|