📄 bzip2.examples.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Examples</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="bzip2.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.bzip2.html">Bzip2 Functions</a></div> <div class="up"><a href="book.bzip2.html">Bzip2</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div> <h1>Examples</h1> <p class="para"> This example opens a temporary file and writes a test string to it, then prints out the contents of the file. </p> <div class="example"> <p><b>Example #1 Small bzip2 Example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /><br />$filename </span><span style="color: #007700">= </span><span style="color: #DD0000">"/tmp/testfile.bz2"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$str </span><span style="color: #007700">= </span><span style="color: #DD0000">"This is a test string.\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// open file for writing<br /></span><span style="color: #0000BB">$bz </span><span style="color: #007700">= </span><span style="color: #0000BB">bzopen</span><span style="color: #007700">(</span><span style="color: #0000BB">$filename</span><span style="color: #007700">, </span><span style="color: #DD0000">"w"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// write string to file<br /></span><span style="color: #0000BB">bzwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$bz</span><span style="color: #007700">, </span><span style="color: #0000BB">$str</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// close file<br /></span><span style="color: #0000BB">bzclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$bz</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// open file for reading<br /></span><span style="color: #0000BB">$bz </span><span style="color: #007700">= </span><span style="color: #0000BB">bzopen</span><span style="color: #007700">(</span><span style="color: #0000BB">$filename</span><span style="color: #007700">, </span><span style="color: #DD0000">"r"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// read 10 characters<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">bzread</span><span style="color: #007700">(</span><span style="color: #0000BB">$bz</span><span style="color: #007700">, </span><span style="color: #0000BB">10</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// output until end of the file (or the next 1024 char) and close it. <br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">bzread</span><span style="color: #007700">(</span><span style="color: #0000BB">$bz</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">bzclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$bz</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="bzip2.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.bzip2.html">Bzip2 Functions</a></div> <div class="up"><a href="book.bzip2.html">Bzip2</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -