<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.opcache.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.opcache-compile-file.php',
    1 => 'opcache_compile_file',
    2 => '无需运行，即可编译并缓存 PHP 脚本',
  ),
  'up' => 
  array (
    0 => 'ref.opcache.php',
    1 => 'OPcache 函数',
  ),
  'prev' => 
  array (
    0 => 'ref.opcache.php',
    1 => 'OPcache 函数',
  ),
  'next' => 
  array (
    0 => 'function.opcache-get-configuration.php',
    1 => 'opcache_get_configuration',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/opcache/functions/opcache-compile-file.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.opcache-compile-file" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">opcache_compile_file</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.5.5, PHP 7, PHP 8, PECL ZendOpcache &gt; 7.0.2)</p><p class="refpurpose"><span class="refname">opcache_compile_file</span> &mdash; <span class="dc-title">无需运行，即可编译并缓存 PHP 脚本</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.opcache-compile-file-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>opcache_compile_file</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="simpara">
   该函数可以用于在不用运行某个 PHP 脚本的情况下，编译该 PHP 脚本并将其添加到字节码缓存中去。
   该函数可用于在 Web 服务器重启之后初始化缓存，以供后续请求调用。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.opcache-compile-file-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">filename</code></dt>
    <dd>
     <span class="simpara">
      被编译的 PHP 脚本的路径。
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.opcache-compile-file-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="simpara">
   如果 <code class="parameter">filename</code> 被成功编译，则返回 <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>  或者在失败时返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>。
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.opcache-compile-file-errors">
  <h3 class="title">错误／异常</h3>
  <p class="simpara">
   如果 <code class="parameter">filename</code> 不能被载入或者不能被编译，则会生成 <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> 级别的错误。
   可以使用 <a href="language.operators.errorcontrol.php" class="link">@</a> 来抑制该警告。
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.opcache-compile-file-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.opcache-invalidate.php" class="function" rel="rdfs-seeAlso">opcache_invalidate()</a> - 废除脚本缓存</span></li>
  </ul>
 </div>

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