mirror of
https://github.com/php/doc-ja.git
synced 2026-03-23 22:52:11 +01:00
65 lines
1.6 KiB
XML
65 lines
1.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 5fdeb11b137c94a6d25cbe98a2e14c00366197cf Maintainer: takagi Status: ready -->
|
|
<!-- CREDITS: hirokawa -->
|
|
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="bzip2.examples">
|
|
&reftitle.examples;
|
|
<simpara>
|
|
この例は、テンポラリファイルをオープンし、テスト用の文字列を書き込みます。
|
|
この後、このファイルの内容を出力します。
|
|
</simpara>
|
|
<example>
|
|
<title>簡単な bzip2 の例</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$filename = "/tmp/testfile.bz2";
|
|
$str = "This is a test string.\n";
|
|
|
|
// 書き込み用にオープン
|
|
$bz = bzopen($filename, "w");
|
|
|
|
// ファイルに文字列を書き込む
|
|
bzwrite($bz, $str);
|
|
|
|
// ファイルを閉じる
|
|
bzclose($bz);
|
|
|
|
// 読み込み用にファイルをオープン
|
|
$bz = bzopen($filename, "r");
|
|
|
|
// 10文字読み込む
|
|
echo bzread($bz, 10);
|
|
|
|
// ファイルの終端まで出力(または次の1024文字)し、閉じる
|
|
echo bzread($bz);
|
|
|
|
bzclose($bz);
|
|
|
|
?>
|
|
]]>
|
|
</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:"~/.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
|
|
-->
|