📄 function.xdiff-file-bpatch.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Patch a file with a binary diff</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.xdiff-file-bdiff.html">xdiff_file_bdiff</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.xdiff-file-diff-binary.html">xdiff_file_diff_binary</a></div> <div class="up"><a href="ref.xdiff.html">xdiff Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.xdiff-file-bpatch" class="refentry"> <div class="refnamediv"> <h1 class="refname">xdiff_file_bpatch</h1> <p class="verinfo">(No version information available, might be only in CVS)</p><p class="refpurpose"><span class="refname">xdiff_file_bpatch</span> — <span class="dc-title">Patch a file with a binary diff</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>xdiff_file_bpatch</b></b></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$file</tt></span> , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$patch</tt></span> , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$dest</tt></span> )</div> <p class="para rdfs-comment"> Patches a <i><tt class="parameter">file</tt></i> with a binary <i><tt class="parameter">patch</tt></i> and stores the result in a file <i><tt class="parameter">dest</tt></i>. This function accepts patches created both via <a href="function.xdiff-file-bdiff.html" class="function">xdiff_file_bdiff()</a> and <a href="function.xdiff-file-rabdiff.html" class="function">xdiff_file_rabdiff()</a> functions or their string counterparts. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">file</tt></i></span> <dd> <p class="para"> The original file. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">patch</tt></i></span> <dd> <p class="para"> The binary patch file. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">dest</tt></i></span> <dd> <p class="para"> Path of the resulting file. </p> </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 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 <b>xdiff_file_bpatch()</b> example</b></p> <div class="example-contents"><p> The following code applies binary diff to a file. </p></div> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br />$old_version </span><span style="color: #007700">= </span><span style="color: #DD0000">'archive-1.0.tgz'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$patch </span><span style="color: #007700">= </span><span style="color: #DD0000">'archive.bpatch'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #0000BB">xdiff_file_bpatch</span><span style="color: #007700">(</span><span style="color: #0000BB">$old_version</span><span style="color: #007700">, </span><span style="color: #0000BB">$patch</span><span style="color: #007700">, </span><span style="color: #DD0000">'archive-1.1.tgz'</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">$result</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"File patched"</span><span style="color: #007700">;<br />} else {<br /> echo </span><span style="color: #DD0000">"File couldn't be patched"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> </div> <div class="refsect1 notes"> <h3 class="title">Notes</h3> <blockquote><p><b class="note">Note</b>: Both files (<i><tt class="parameter">file</tt></i> and <i><tt class="parameter">patch</tt></i>) will be loaded into memory so ensure that your memory_limit is set high enough. <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.xdiff-file-bdiff.html" class="function" rel="rdfs-seeAlso">xdiff_file_bdiff()</a></li> <li class="member"><a href="function.xdiff-file-rabdiff.html" class="function" rel="rdfs-seeAlso">xdiff_file_rabdiff()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.xdiff-file-bdiff.html">xdiff_file_bdiff</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.xdiff-file-diff-binary.html">xdiff_file_diff_binary</a></div> <div class="up"><a href="ref.xdiff.html">xdiff Functions</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 + -