<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.zlib.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.deflate-init.php',
    1 => 'deflate_init',
    2 => 'Initialize an incremental deflate context',
  ),
  'up' => 
  array (
    0 => 'ref.zlib.php',
    1 => 'Zlib 函数',
  ),
  'prev' => 
  array (
    0 => 'function.deflate-add.php',
    1 => 'deflate_add',
  ),
  'next' => 
  array (
    0 => 'function.gzclose.php',
    1 => 'gzclose',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/zlib/functions/deflate_init.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.deflate-init" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">deflate_init</h1>
  <p class="verinfo">(PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">deflate_init</span> &mdash; <span class="dc-title">Initialize an incremental deflate context</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.deflate-init-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>deflate_init</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$encoding</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.object.php" class="type object">object</a></span></span> <code class="parameter">$options</code><span class="initializer"> = []</span></span>): <span class="type"><span class="type"><a href="class.deflatecontext.php" class="type DeflateContext">DeflateContext</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Initializes an incremental deflate context using the specified
   <code class="parameter">encoding</code>.
  </p>
  <p class="para">
   Note that the <code class="literal">window</code> option here only sets the window size
   of the algorithm, differently from the zlib filters where the same parameter
   also sets the encoding to use; the encoding must be set with the
   <code class="parameter">encoding</code> parameter.
  </p>
  <p class="para">
   Limitation: there is currently no way to set the header information on a GZIP
   compressed stream, which are set as follows: GZIP signature
   (<code class="literal">\x1f\x8B</code>); compression method (<code class="literal">\x08</code>
   == DEFLATE); 6 zero bytes; the operating system set to the current system
   (<code class="literal">\x00</code> = Windows, <code class="literal">\x03</code> = Unix, etc.)
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.deflate-init-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">encoding</code></dt>
    <dd>
     <p class="para">
      One of the <strong><code><a href="zlib.constants.php#constant.zlib-encoding-raw">ZLIB_ENCODING_<span class="replaceable">*</span></a></code></strong> constants.
     </p>
    </dd>
   
   
    <dt><code class="parameter">options</code></dt>
    <dd>
     <p class="para">
      An associative array which may contain the following elements:
      <dl>
       
        <dt><var class="varname">level</var></dt>
        <dd>
         <p class="para">
          The compression level in range -1..9; defaults to -1.
         </p>
        </dd>
       
       
        <dt><var class="varname">memory</var></dt>
        <dd>
         <p class="para">
          The compression memory level in range 1..9; defaults to 8.
         </p>
        </dd>
       
       
        <dt><var class="varname">window</var></dt>
        <dd>
         <p class="para">
          The zlib window size (logarithmic) in range <code class="literal">8</code>..<code class="literal">15</code>;
          defaults to <code class="literal">15</code>.
          zlib changes a window size of <code class="literal">8</code> to <code class="literal">9</code>,
          and as of zlib 1.2.8 fails with a warning, if a window size of <code class="literal">8</code>
          is requested for <strong><code><a href="zlib.constants.php#constant.zlib-encoding-raw">ZLIB_ENCODING_RAW</a></code></strong> or <strong><code><a href="zlib.constants.php#constant.zlib-encoding-gzip">ZLIB_ENCODING_GZIP</a></code></strong>.
         </p>
        </dd>
       
       
        <dt><var class="varname">strategy</var></dt>
        <dd>
         <p class="para">
          One of <strong><code><a href="zlib.constants.php#constant.zlib-filtered">ZLIB_FILTERED</a></code></strong>,
          <strong><code><a href="zlib.constants.php#constant.zlib-huffman-only">ZLIB_HUFFMAN_ONLY</a></code></strong>, <strong><code><a href="zlib.constants.php#constant.zlib-rle">ZLIB_RLE</a></code></strong>,
          <strong><code><a href="zlib.constants.php#constant.zlib-fixed">ZLIB_FIXED</a></code></strong> or
          <strong><code><a href="zlib.constants.php#constant.zlib-default-strategy">ZLIB_DEFAULT_STRATEGY</a></code></strong> (the default).
         </p>
        </dd>
       
       
        <dt><var class="varname">dictionary</var></dt>
        <dd>
         <p class="para">
          A <span class="type"><a href="language.types.string.php" class="type string">string</a></span> or an <span class="type"><a href="language.types.array.php" class="type array">array</a></span> of <span class="type">strings</span>
          of the preset dictionary (default: no preset dictionary).
         </p>
        </dd>
       
      </dl>
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.deflate-init-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a deflate context resource (<code class="literal">zlib.deflate</code>) on
   success,  或者在失败时返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.deflate-init-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   If an invalid option is passed to <code class="parameter">options</code> or the
   context couldn&#039;t be created, an error of level <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong>
   is generated.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.deflate-init-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       On success, this function returns a <span class="classname"><a href="class.deflatecontext.php" class="classname">DeflateContext</a></span> instance now;
       previously, a <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> was returned.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 seealso" id="refsect1-function.deflate-init-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.deflate-add.php" class="function" rel="rdfs-seeAlso">deflate_add()</a> - Incrementally deflate data</span></li>
   <li><span class="function"><a href="function.inflate-init.php" class="function" rel="rdfs-seeAlso">inflate_init()</a> - Initialize an incremental inflate context</span></li>
  </ul>
 </div>


</div><?php manual_footer($setup); ?>