function.ftruncate.html
来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 153 行
HTML
153 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Truncates a file to a given length</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="function.ftell.html">ftell</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.fwrite.html">fwrite</a></div> <div class="up"><a href="ref.filesystem.html">Filesystem Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.ftruncate" class="refentry"> <div class="refnamediv"> <h1 class="refname">ftruncate</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">ftruncate</span> — <span class="dc-title">Truncates a file to a given length</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><b><b>ftruncate</b></b></span> ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$handle</tt></span> , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$size</tt></span> )</div> <p class="para rdfs-comment"> Takes the filepointer, <i><tt class="parameter">handle</tt></i>, and truncates the file to length, <i><tt class="parameter">size</tt></i>. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">handle</tt></i></span> <dd> <p class="para"> The file pointer. </p> <blockquote><p><b class="note">Note</b>: The <i><tt class="parameter">handle</tt></i> must be open for writing. <br /> </p></blockquote> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">size</tt></i></span> <dd> <p class="para"> The size to truncate to. </p> <blockquote><p><b class="note">Note</b>: If <i><tt class="parameter">size</tt></i> is larger than the file it is extended with null bytes. <br /> If <i><tt class="parameter">size</tt></i> is smaller than the extra data will be lost. <br /> </p></blockquote> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <b><tt>TRUE</tt></b> on success or <b><tt>FALSE</tt></b> on failure. </p> </div> <div class="refsect1 changelog"> <h3 class="title">ChangeLog</h3> <p class="para"> <table class="informaltable"> <colgroup> <thead valign="middle"> <tr valign="middle"> <th colspan="1">Version</th> <th colspan="1">Description</th> </tr> </thead> <tbody valign="middle" class="tbody"> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">PHP 4.3.3</td> <td colspan="1" rowspan="1" align="left"> Prior to this release <b>ftruncate()</b> returned an <a href="language.types.integer.html" class="type integer">integer</a> value of 1 on success, instead of <a href="language.types.boolean.html" class="type boolean">boolean</a> <b><tt>TRUE</tt></b>. </td> </tr> </tbody> </colgroup> </table> </p> </div> <div class="refsect1 notes"> <h3 class="title">Notes</h3> <blockquote><p><b class="note">Note</b>: The file pointer is <em class="emphasis">not</em> changed. <br /> </p></blockquote> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="function.fopen.html" class="function" rel="rdfs-seeAlso">fopen()</a></li> <li class="member"><a href="function.fseek.html" class="function" rel="rdfs-seeAlso">fseek()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ftell.html">ftell</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.fwrite.html">fwrite</a></div> <div class="up"><a href="ref.filesystem.html">Filesystem Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?