⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.mysql-pconnect.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Open a persistent connection to a MySQL server</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.mysql-num-rows.html">mysql_num_rows</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mysql-ping.html">mysql_ping</a></div> <div class="up"><a href="ref.mysql.html">MySQL Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.mysql-pconnect" class="refentry"> <div class="refnamediv">  <h1 class="refname">mysql_pconnect</h1>  <p class="verinfo">(PHP 4, PHP 5, PECL mysql:1.0)</p><p class="refpurpose"><span class="refname">mysql_pconnect</span> &mdash; <span class="dc-title">Open a persistent connection to a MySQL server</span></p> </div> <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">resource</span> <span class="methodname"><b><b>mysql_pconnect</b></b></span>    ([ <span class="methodparam"><span class="type">string</span> <tt class="parameter">$server</tt></span>   [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$username</tt></span>   [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$password</tt></span>   [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$client_flags</tt></span>  ]]]] )</div>    <p class="para rdfs-comment">   Establishes a persistent connection to a MySQL server.  </p>    <p class="para">   <b>mysql_pconnect()</b> acts very much like   <a href="function.mysql-connect.html" class="function">mysql_connect()</a> with two major differences.  </p>  <p class="para">   First, when connecting, the function would first try to find a   (persistent) link that&#039;s already open with the same host,   username and password.  If one is found, an identifier for it   will be returned instead of opening a new connection.  </p>  <p class="para">   Second, the connection to the SQL server will not be closed when   the execution of the script ends.  Instead, the link will remain   open for future use (<a href="function.mysql-close.html" class="function">mysql_close()</a> will not   close links established by <b>mysql_pconnect()</b>).  </p>  <p class="para">   This type of link is therefore called &#039;persistent&#039;.  </p> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">server</tt></i></span>     <dd>      <p class="para">       The MySQL server. It can also include a port number. e.g.        &quot;hostname:port&quot; or a path to a local socket e.g. &quot;:/path/to/socket&quot; for        the localhost.      </p>      <p class="para">       If the PHP directive <a href="mysql.configuration.html#ini.mysql.default-host" class="link">       mysql.default_host</a> is undefined (default), then the default        value is &#039;localhost:3306&#039;      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">username</tt></i></span>     <dd>      <p class="para">       The username. Default value is the name of the user that owns the       server process.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">password</tt></i></span>     <dd>      <p class="para">       The password. Default value is an empty password.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">client_flags</tt></i></span>     <dd>      <p class="para">       The <i><tt class="parameter">client_flags</tt></i> parameter can be a combination        of the following constants:       128 (enable <i>LOAD DATA LOCAL</i> handling),       <b><tt>MYSQL_CLIENT_SSL</tt></b>,        <b><tt>MYSQL_CLIENT_COMPRESS</tt></b>,        <b><tt>MYSQL_CLIENT_IGNORE_SPACE</tt></b> or       <b><tt>MYSQL_CLIENT_INTERACTIVE</tt></b>.      </p>     </dd>    </dt>    </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">   Returns a MySQL persistent link identifier on success, or <b><tt>FALSE</tt></b> on    failure.  </p> </div>  <div class="refsect1 changelog">  <h3 class="title">ChangeLog</h3>  <p class="para">   <table class="informaltable">    <colgroup>     <thead valign="middle">      <tr valign="middle">       <th colspan="1">Version</th>       <th colspan="1">Description</th>      </tr>     </thead>     <tbody valign="middle" class="tbody">      <tr valign="middle">       <td colspan="1" rowspan="1" align="left">4.3.0</td>       <td colspan="1" rowspan="1" align="left">        Added the <i><tt class="parameter">client_flags</tt></i> parameter.       </td>      </tr>      <tr valign="middle">       <td colspan="1" rowspan="1" align="left">3.0.10</td>       <td colspan="1" rowspan="1" align="left">        Added support for &quot;:/path/to/socket&quot; with         <i><tt class="parameter">server</tt></i>.       </td>      </tr>      <tr valign="middle">       <td colspan="1" rowspan="1" align="left">3.0.0</td>       <td colspan="1" rowspan="1" align="left">        Added support for &quot;:port&quot; with <i><tt class="parameter">server</tt></i>.       </td>      </tr>     </tbody>    </colgroup>   </table>  </p> </div> <div class="refsect1 notes">  <h3 class="title">Notes</h3>  <blockquote><p><b class="note">Note</b>:        Note, that these kind of links only work if you are using    a module version of PHP. See the    <a href="features.persistent-connections.html" class="link">Persistent    Database Connections</a> section for more information.   <br />  </p></blockquote>  <div class="warning"><b class="warning">Warning</b>   <p class="para">    Using persistent connections can require a bit of tuning of your Apache    and MySQL configurations to ensure that you do not exceed the number of    connections allowed by MySQL.   </p>  </div>  <blockquote><p><b class="note">Note</b>:        You can suppress the error message on failure by prepending     a <a href="language.operators.errorcontrol.html" class="link">@</a>    to the function name.   <br />  </p></blockquote> </div> <div class="refsect1 seealso">  <h3 class="title">See Also</h3>  <p class="para">   <ul class="simplelist">    <li class="member"><a href="function.mysql-connect.html" class="function" rel="rdfs-seeAlso">mysql_connect()</a></li>    <li class="member"><a href="features.persistent-connections.html" class="link">Persistent    Database Connections</a></li>   </ul>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.mysql-num-rows.html">mysql_num_rows</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mysql-ping.html">mysql_ping</a></div> <div class="up"><a href="ref.mysql.html">MySQL Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -