mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-19 06:16:58 +08:00
131 lines
5.5 KiB
HTML
131 lines
5.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||
<title>Patch a file with a binary diff</title>
|
||
</head>
|
||
<body class="docs"><div id="layout">
|
||
<div id="layout-content"><div id="function.xdiff-file-bpatch" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">xdiff_file_bpatch</h1>
|
||
<p class="verinfo">(PECL xdiff >= 1.5.0)</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" id="refsect1-function.xdiff-file-bpatch-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>xdiff_file_bpatch</strong></span>
|
||
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$file</code></span>
|
||
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$patch</code></span>
|
||
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$dest</code></span>
|
||
) : <span class="type">bool</span></div>
|
||
|
||
<p class="para rdfs-comment">
|
||
Patches a <code class="parameter">file</code> with a binary
|
||
<code class="parameter">patch</code> and stores the result in a file <code class="parameter">dest</code>.
|
||
This function accepts patches created both via <span class="function"><a href="xdiff_file_bdiff.html" class="function">xdiff_file_bdiff()</a></span>
|
||
and <span class="function"><a href="xdiff_file_rabdiff.html" class="function">xdiff_file_rabdiff()</a></span> functions or their string counterparts.
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.xdiff-file-bpatch-parameters">
|
||
<h3 class="title">参数</h3>
|
||
<p class="para">
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">file</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
The original file.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">patch</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
The binary patch file.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">dest</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
Path of the resulting file.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.xdiff-file-bpatch-returnvalues">
|
||
<h3 class="title">返回值</h3>
|
||
<p class="para">
|
||
成功时返回 <strong><code>TRUE</code></strong>, 或者在失败时返回 <strong><code>FALSE</code></strong>。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 examples" id="refsect1-function.xdiff-file-bpatch-examples">
|
||
<h3 class="title">范例</h3>
|
||
<p class="para">
|
||
<div class="example" id="example-2864">
|
||
<p><strong>Example #1 <span class="function"><strong>xdiff_file_bpatch()</strong></span> example</strong></p>
|
||
<div class="example-contents"><p>
|
||
The following code applies binary diff to a file.
|
||
</p></div>
|
||
<div class="example-contents">
|
||
<div class="phpcode"><pre><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>
|
||
</pre></div>
|
||
</div>
|
||
|
||
</div>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 notes" id="refsect1-function.xdiff-file-bpatch-notes">
|
||
<h3 class="title">注释</h3>
|
||
<blockquote class="note"><p><strong class="note">Note</strong>:
|
||
<p class="para">
|
||
Both files (<code class="parameter">file</code> and <code class="parameter">patch</code>)
|
||
will be loaded into memory so ensure that your memory_limit is set high
|
||
enough.
|
||
</p>
|
||
</p></blockquote>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 seealso" id="refsect1-function.xdiff-file-bpatch-seealso">
|
||
<h3 class="title">参见</h3>
|
||
<p class="para">
|
||
<ul class="simplelist">
|
||
<li class="member"><span class="function"><a href="xdiff_file_bdiff.html" class="function" rel="rdfs-seeAlso">xdiff_file_bdiff()</a> - Make binary diff of two files</span></li>
|
||
<li class="member"><span class="function"><a href="xdiff_file_rabdiff.html" class="function" rel="rdfs-seeAlso">xdiff_file_rabdiff()</a> - Make binary diff of two files using the Rabin's polynomial fingerprinting algorithm</span></li>
|
||
</ul>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
</div></div></div></body></html> |