1
0
mirror of https://github.com/php/doc-tr.git synced 2026-03-24 07:12:18 +01:00
Files
archived-doc-tr/reference/zlib/examples.xml
2021-06-04 17:12:08 +03:00

101 lines
2.5 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: eec6a4a36bf452bf271f116e7b6b9bb09d1181c3 Maintainer: nilgun Status: ready -->
<chapter xml:id="zlib.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.examples;
<para>
Bu örnek geçici bir dosya açar ve içine bir deneme dizgesi yazdıktan sonra
dosya içeriğini iki defa basar.
</para>
<example>
<title>- Küçük bir Zlib örneği</title>
<programlisting role="php">
<![CDATA[
<?php
$filename = tempnam('/tmp', 'zlibtest') . '.gz';
echo "<html>\n<head></head>\n<body>\n<pre>\n";
$s = "Only a test, test, test, test, test, test, test, test!\n";
// dosyayı azami sıkıştırmayla açalım
$zp = gzopen($filename, "w9");
// dizgeyi dosyaya yazalım
gzwrite($zp, $s);
// dosyayı kapatalım
gzclose($zp);
// dosyayı okumak için açalım
$zp = gzopen($filename, "r");
// 3 karakter okuyalım
echo gzread($zp, 3);
// dosyayı sonuna kadar çıktılayıp kapatalım.
gzpassthru($zp);
gzclose($zp);
echo "\n";
// dosyayııp içeriğini basalım (ikinci kez).
if (readgzfile($filename) != strlen($s)) {
echo "Zlib işlevlerinde hata!";
}
unlink($filename);
echo "</pre>\n</body>\n</html>\n";
?>
]]>
</programlisting>
</example>
<example>
<title>- Ardışık sıkıştırma ve açma arayüzü örneği</title>
<programlisting role="php">
<![CDATA[
<?php
// GZIP sıkıştırması gerçekleştirelim:
$deflateContext = deflate_init(ZLIB_ENCODING_GZIP);
$compressed = deflate_add($deflateContext, "Sıkıştırılacak veri", ZLIB_NO_FLUSH);
$compressed .= deflate_add($deflateContext, ", biraz daha", ZLIB_NO_FLUSH);
$compressed .= deflate_add($deflateContext, " ve biraz daha!", ZLIB_FINISH);
// GZIP sıkıştırmasını açalım:
$inflateContext = inflate_init(ZLIB_ENCODING_GZIP);
$uncompressed = inflate_add($inflateContext, $compressed, ZLIB_NO_FLUSH);
$uncompressed .= inflate_add($inflateContext, NULL, ZLIB_FINISH);
echo $uncompressed;
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Sıkıştırılacak veri, biraz daha, ve biraz daha!
]]>
</screen>
</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:"~/.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
-->