<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.mysqli-stmt.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'mysqli-stmt.construct.php',
    1 => 'mysqli_stmt::__construct',
    2 => 'Constructs a new mysqli_stmt object',
  ),
  'up' => 
  array (
    0 => 'class.mysqli-stmt.php',
    1 => 'mysqli_stmt',
  ),
  'prev' => 
  array (
    0 => 'mysqli-stmt.close.php',
    1 => 'mysqli_stmt::close',
  ),
  'next' => 
  array (
    0 => 'mysqli-stmt.data-seek.php',
    1 => 'mysqli_stmt::data_seek',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mysqli/mysqli_stmt/construct.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mysqli-stmt.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mysqli_stmt::__construct</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">mysqli_stmt::__construct</span> &mdash; <span class="dc-title">Constructs a new <span class="classname"><a href="class.mysqli-stmt.php" class="classname">mysqli_stmt</a></span> object</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mysqli-stmt.construct-description">
  <h3 class="title">说明</h3>
  <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>mysqli_stmt::__construct</strong></span>(<span class="methodparam"><span class="type"><a href="class.mysqli.php" class="type mysqli">mysqli</a></span> <code class="parameter">$mysql</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$query</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>)</div>

  <p class="para rdfs-comment">
   This method constructs a new <span class="classname"><a href="class.mysqli-stmt.php" class="classname">mysqli_stmt</a></span> object.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mysqli-stmt.construct-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">link</code></dt>
     <dd>
      <p class="para">
       A valid <span class="classname"><a href="class.mysqli.php" class="classname">mysqli</a></span> object.
      </p>
     </dd>
    
    
     <dt><code class="parameter">query</code></dt>
     <dd>
      <p class="para">
       The query, as a string. If this parameter is <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>, then the
       constructor behaves identically to
       <span class="function"><a href="mysqli.stmt-init.php" class="function">mysqli_stmt_init()</a></span>, otherwise it behaves as
       per <span class="function"><a href="mysqli.prepare.php" class="function">mysqli_prepare()</a></span>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-mysqli-stmt.construct-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
If mysqli error reporting is enabled (<strong><code><a href="mysqli.constants.php#constant.mysqli-report-error">MYSQLI_REPORT_ERROR</a></code></strong>) and the requested operation fails,
a warning is generated. If, in addition, the mode is set to <strong><code><a href="mysqli.constants.php#constant.mysqli-report-strict">MYSQLI_REPORT_STRICT</a></code></strong>,
a <span class="classname"><a href="class.mysqli-sql-exception.php" class="classname">mysqli_sql_exception</a></span> is thrown instead.</p>
 </div>


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

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">query</code> is now nullable.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 seealso" id="refsect1-mysqli-stmt.construct-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="mysqli.prepare.php" class="function" rel="rdfs-seeAlso">mysqli_prepare()</a> - 预处理执行 SQL</span></li>
    <li><span class="function"><a href="mysqli.stmt-init.php" class="function" rel="rdfs-seeAlso">mysqli_stmt_init()</a> - 初始化语句并返回用于 mysqli_stmt_prepare（调用）的对象</span></li>
   </ul>
  </p>
 </div>

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