Files
doc-fr/reference/zlib/examples.xml
Yannick Torres 2b03a9b548 new translation
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@260810 c90b9560-bf6c-de11-be94-00142212c4b1
2008-06-05 21:03:12 +00:00

78 lines
1.7 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- EN-Revision: 1.2 Maintainer: yannick Status: ready -->
<!-- Reviewed: no -->
<chapter xml:id="zlib.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.examples;
<para>
Cette exemple ouvre un fichier temporaire et y écrit une chaîne de test,
puis, affiche le contenu de ce fichier, deux fois.
</para>
<example>
<title>Exemple avec Zlib</title>
<programlisting role="php">
<![CDATA[
<?php
$filename = tempnam('/tmp', 'zlibtest') . '.gz';
echo "<html>\n<head></head>\n<body>\n<pre>\n";
$s = "Seulement un test, test, test, test, test, test, test, test!\n";
// ouvre un fichier en écriture, avec une compression maximale
$zp = gzopen($filename, "w9");
// écrit une chaîne dans le fichier
gzwrite($zp, $s);
// ferme le fichier
gzclose($zp);
// ouvre un fichier en lecture
$zp = gzopen($filename, "r");
// lit 3 caractères
echo gzread($zp, 3);
// lit tout le contenu et ferme le fichier
gzpassthru($zp);
gzclose($zp);
echo "\n";
// ouvre un fichier et affiche le contenu (pour la deuxième fois).
if (readgzfile($filename) != strlen($s)) {
echo "Erreur avec les fonctions zlib !";
}
unlink($filename);
echo "</pre>\n</body>\n</html>\n";
?>
]]>
</programlisting>
</example>
</chapter>
<!-- 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
-->