<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.funchand.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.function-exists.php',
    1 => 'function_exists',
    2 => '如果给定的函数已经被定义就返回 true',
  ),
  'up' => 
  array (
    0 => 'ref.funchand.php',
    1 => '函数处理 函数',
  ),
  'prev' => 
  array (
    0 => 'function.func-num-args.php',
    1 => 'func_num_args',
  ),
  'next' => 
  array (
    0 => 'function.get-defined-functions.php',
    1 => 'get_defined_functions',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/funchand/functions/function-exists.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.function-exists" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">function_exists</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">function_exists</span> &mdash; <span class="dc-title">如果给定的函数已经被定义就返回 <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></span></p>

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

  <p class="para rdfs-comment">
   在已经定义的函数列表（包括系统自带的函数和用户自定义的函数）中查找 <code class="parameter">function</code>。 
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.function-exists-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">function</code></dt>
     <dd>
      <p class="para">
       函数名，必须为一个字符串。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.function-exists-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   如果 <code class="parameter">function</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>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    对于语法结构的判断，例如 <span class="function"><a href="function.include-once.php" class="function">include_once</a></span> 和 <span class="function"><a href="function.echo.php" class="function">echo</a></span> 将会返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>。
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 examples" id="refsect1-function.function-exists-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 <span class="function"><strong>function_exists()</strong></span> 的例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">function_exists</span><span style="color: #007700">(</span><span style="color: #DD0000">'imap_open'</span><span style="color: #007700">)) {<br />    echo </span><span style="color: #DD0000">"IMAP functions are available.&lt;br /&gt;\n"</span><span style="color: #007700">;<br />} else {<br />    echo </span><span style="color: #DD0000">"IMAP functions are not available.&lt;br /&gt;\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.function-exists-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    即使函数本身由于配置或者编译选项而无法使用，该函数名也可能存在（<a href="ref.image.php" class="link">image</a> 就是一个现成的例子）。
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.function-exists-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.method-exists.php" class="function" rel="rdfs-seeAlso">method_exists()</a> - 检查类的方法是否存在</span></li>
    <li><span class="function"><a href="function.is-callable.php" class="function" rel="rdfs-seeAlso">is_callable()</a> - 验证值是否可以在当前范围内作为函数调用</span></li>
    <li><span class="function"><a href="function.get-defined-functions.php" class="function" rel="rdfs-seeAlso">get_defined_functions()</a> - 返回所有已定义函数的数组</span></li>
    <li><span class="function"><a href="function.class-exists.php" class="function" rel="rdfs-seeAlso">class_exists()</a> - 查类是否已经定义</span></li>
    <li><span class="function"><a href="function.extension-loaded.php" class="function" rel="rdfs-seeAlso">extension_loaded()</a> - 检查一个扩展是否已经加载</span></li>
   </ul>
  </p>
 </div>


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