<?php include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc'; $TOC = array(); $TOC_DEPRECATED = array(); $PARENTS = array(); include_once dirname(__FILE__) ."/toc/class.mongodb-bson-document.inc"; $setup = array ( 'home' => array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'mongodb-bson-document.has.php', 1 => 'MongoDB\\BSON\\Document::has', 2 => 'Returns whether a key is present in the document', ), 'up' => array ( 0 => 'class.mongodb-bson-document.php', 1 => 'MongoDB\\BSON\\Document', ), 'prev' => array ( 0 => 'mongodb-bson-document.getiterator.php', 1 => 'MongoDB\\BSON\\Document::getIterator', ), 'next' => array ( 0 => 'mongodb-bson-document.offsetexists.php', 1 => 'MongoDB\\BSON\\Document::offsetExists', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/mongodb/bson/document/has.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?> <div id="mongodb-bson-document.has" class="refentry"> <div class="refnamediv"> <h1 class="refname">MongoDB\BSON\Document::has</h1> <p class="verinfo">(mongodb >=1.16.0)</p><p class="refpurpose"><span class="refname">MongoDB\BSON\Document::has</span> — <span class="dc-title">Returns whether a key is present in the document</span></p> </div> <div class="refsect1 description" id="refsect1-mongodb-bson-document.has-description"> <h3 class="title">说明</h3> <div class="methodsynopsis dc-description"> <span class="modifier">final</span> <span class="modifier">public</span> <span class="methodname"><strong>MongoDB\BSON\Document::has</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$key</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div> </div> <div class="refsect1 parameters" id="refsect1-mongodb-bson-document.has-parameters"> <h3 class="title">参数</h3> <dl> <dt><code class="parameter">key</code> (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)</dt> <dd> <p class="para"> The key to look for in the document. </p> </dd> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-mongodb-bson-document.has-returnvalues"> <h3 class="title">返回值</h3> <p class="para"> Returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> if the key is present in the document and <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> otherwise. </p> </div> <div class="refsect1 errors" id="refsect1-mongodb-bson-document.has-errors"> <h3 class="title">错误/异常</h3> <ul class="simplelist"> <li>Throws <span class="classname"><a href="class.mongodb-driver-exception-invalidargumentexception.php" class="classname">MongoDB\Driver\Exception\InvalidArgumentException</a></span> on argument parsing errors.</li> </ul> </div> <div class="refsect1 seealso" id="refsect1-mongodb-bson-document.has-seealso"> <h3 class="title">参见</h3> <ul class="simplelist"> <li><span class="methodname"><a href="mongodb-bson-document.get.php" class="methodname" rel="rdfs-seeAlso">MongoDB\BSON\Document::get()</a> - Returns the value of a key in the document</span></li> <li><a href="https://www.mongodb.com/docs/manual/reference/bson-types/" class="link external">» BSON Types</a></li> </ul> </div> </div><?php manual_footer($setup); ?>