mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
105 lines
5.1 KiB
HTML
105 lines
5.1 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>如果给定的函数已经被定义就返回 TRUE</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><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)</p><p class="refpurpose"><span class="refname">function_exists</span> — <span class="dc-title">如果给定的函数已经被定义就返回 <strong><code>TRUE</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">string</span> <code class="parameter">$function_name</code></span>
|
|
) : <span class="type">bool</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
在已经定义的函数列表(包括系统自带的函数和用户自定义的函数)中查找 <code class="parameter">function_name</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_name</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_name</code> 存在且的确是一个函数就返回 <strong><code>TRUE</code></strong> ,反之则返回 <strong><code>FALSE</code></strong> 。
|
|
</p>
|
|
<blockquote class="note"><p><strong class="note">Note</strong>:
|
|
<p class="para">
|
|
对于语法结构的判断,例如 <span class="function"><a href="include_once.html" class="function">include_once</a></span> 和 <span class="function"><a href="echo.html" class="function">echo</a></span> 将会返回 <strong><code>FALSE</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-6206">
|
|
<p><strong>Example #1 <span class="function"><strong>function_exists()</strong></span> 的例子</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?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.<br />\n"</span><span style="color: #007700">;<br />} else {<br /> echo </span><span style="color: #DD0000">"IMAP functions are not available.<br />\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></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">Note</strong>:
|
|
<p class="para">
|
|
当本配置或者编译或编译选项禁用某函数时,该函数名也可能存在( <a href="ref.image.html" 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 class="member"><span class="function"><a href="method_exists.html" class="function" rel="rdfs-seeAlso">method_exists()</a> - 检查类的方法是否存在</span></li>
|
|
<li class="member"><span class="function"><a href="is_callable.html" class="function" rel="rdfs-seeAlso">is_callable()</a> - 检测参数是否为合法的可调用结构</span></li>
|
|
<li class="member"><span class="function"><a href="get_defined_functions.html" class="function" rel="rdfs-seeAlso">get_defined_functions()</a> - 返回所有已定义函数的数组</span></li>
|
|
<li class="member"><span class="function"><a href="class_exists.html" class="function" rel="rdfs-seeAlso">class_exists()</a> - 检查类是否已定义</span></li>
|
|
<li class="member"><span class="function"><a href="extension_loaded.html" class="function" rel="rdfs-seeAlso">extension_loaded()</a> - 检查一个扩展是否已经加载</span></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
</div></div></div></body></html> |