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@260810 c90b9560-bf6c-de11-be94-00142212c4b1
78 lines
1.7 KiB
XML
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
|
|
-->
|
|
|
|
|