<?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-get-status.php',
    1 => 'opcache_get_status',
    2 => '获取缓存的状态信息',
  ),
  'up' => 
  array (
    0 => 'ref.opcache.php',
    1 => 'OPcache 函数',
  ),
  'prev' => 
  array (
    0 => 'function.opcache-get-configuration.php',
    1 => 'opcache_get_configuration',
  ),
  'next' => 
  array (
    0 => 'function.opcache-invalidate.php',
    1 => 'opcache_invalidate',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/opcache/functions/opcache-get-status.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.opcache-get-status" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">opcache_get_status</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.5.0, PHP 7, PHP 8, PECL ZendOpcache &gt; 7.0.2)</p><p class="refpurpose"><span class="refname">opcache_get_status</span> &mdash; <span class="dc-title">获取缓存的状态信息</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.opcache-get-status-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>opcache_get_status</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$include_scripts</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></span></span>): <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.singleton.php" class="type false">false</a></span></span></div>

  <p class="simpara">
   该函数将返回内存中缓存实例的状态信息。不会返回有关文件缓存的任何信息。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.opcache-get-status-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">include_scripts</code></dt>
    <dd>
     <span class="simpara">
      包含脚本的具体声明信息。
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.opcache-get-status-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="simpara">
   返回可能包含脚本特定状态信息的数组， 或者在失败时返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>。
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.opcache-get-status-errors">
  <h3 class="title">错误／异常</h3>
  <p class="simpara">
   在启用了 <code class="literal">opcache.restrict_api</code> 的情况下，如果当前路径在禁止规则里，将会出现 E_WARNING ；不会返回任何状态信息。
  </p>
 </div>


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

    </thead>

    <tbody class="tbody">
     <tr>
      <td>PHP 8.3.0</td>
      <td>
       <code class="code">opcache_get_status()[&#039;scripts&#039;][n][&#039;revalidate&#039;]</code> 现在包含 Unix
       时间戳，表示下次重新验证脚本时间戳的时间，由
       <a href="opcache.configuration.php#ini.opcache.revalidate-freq" class="link"><code class="literal">opcache.revalidate_freq</code></a> INI 指令指定。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.opcache-get-status-examples">
  <h3 class="title">示例</h3>
  <div class="example" id="example-1">
   <p><strong>示例 #1 <span class="function"><strong>opcache_get_status()</strong></span> 示例</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">opcache_get_status</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>以上示例的输出类似于：</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">array(9) {
  &#039;opcache_enabled&#039; =&gt;
  bool(true)
  &#039;cache_full&#039; =&gt;
  bool(false)
  &#039;restart_pending&#039; =&gt;
  bool(false)
  &#039;restart_in_progress&#039; =&gt;
  bool(false)
  &#039;memory_usage&#039; =&gt;
  array(4) {
    &#039;used_memory&#039; =&gt;
    int(9167936)
    &#039;free_memory&#039; =&gt;
    int(125049792)
    &#039;wasted_memory&#039; =&gt;
    int(0)
    &#039;current_wasted_percentage&#039; =&gt;
    double(0)
  }
  &#039;interned_strings_usage&#039; =&gt;
  array(4) {
    &#039;buffer_size&#039; =&gt;
    int(8388608)
    &#039;used_memory&#039; =&gt;
    int(2593616)
    &#039;free_memory&#039; =&gt;
    int(5794992)
    &#039;number_of_strings&#039; =&gt;
    int(10358)
  }
  &#039;opcache_statistics&#039; =&gt;
  array(13) {
    &#039;num_cached_scripts&#039; =&gt;
    int(0)
    &#039;num_cached_keys&#039; =&gt;
    int(0)
    &#039;max_cached_keys&#039; =&gt;
    int(16229)
    &#039;hits&#039; =&gt;
    int(0)
    &#039;start_time&#039; =&gt;
    int(1733310010)
    &#039;last_restart_time&#039; =&gt;
    int(0)
    &#039;oom_restarts&#039; =&gt;
    int(0)
    &#039;hash_restarts&#039; =&gt;
    int(0)
    &#039;manual_restarts&#039; =&gt;
    int(0)
    &#039;misses&#039; =&gt;
    int(0)
    &#039;blacklist_misses&#039; =&gt;
    int(0)
    &#039;blacklist_miss_ratio&#039; =&gt;
    double(0)
    &#039;opcache_hit_rate&#039; =&gt;
    double(0)
  }
  &#039;scripts&#039; =&gt;
  array(0) {
  }
  &#039;jit&#039; =&gt;
  array(7) {
    &#039;enabled&#039; =&gt;
    bool(false)
    &#039;on&#039; =&gt;
    bool(false)
    &#039;kind&#039; =&gt;
    int(5)
    &#039;opt_level&#039; =&gt;
    int(4)
    &#039;opt_flags&#039; =&gt;
    int(6)
    &#039;buffer_size&#039; =&gt;
    int(0)
    &#039;buffer_free&#039; =&gt;
    int(0)
  }
}</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.opcache-get-status-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.opcache-get-configuration.php" class="function" rel="rdfs-seeAlso">opcache_get_configuration()</a> - 获取缓存的配置信息</span></li>
  </ul>
 </div>


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