uTools-Manuals/docs/php/fbsql_connect.html
2019-04-08 23:22:26 +08:00

126 lines
5.0 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>Open a connection to a FrontBase Server</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.fbsql-connect" class="refentry">
<div class="refnamediv">
<h1 class="refname">fbsql_connect</h1>
<p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">fbsql_connect</span> &mdash; <span class="dc-title">Open a connection to a FrontBase Server</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.fbsql-connect-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>fbsql_connect</strong></span>
([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$hostname</code><span class="initializer"> = ini_get(&quot;fbsql.default_host&quot;)</span></span>
[, <span class="methodparam"><span class="type">string</span> <code class="parameter">$username</code><span class="initializer"> = ini_get(&quot;fbsql.default_user&quot;)</span></span>
[, <span class="methodparam"><span class="type">string</span> <code class="parameter">$password</code><span class="initializer"> = ini_get(&quot;fbsql.default_password&quot;)</span></span>
]]] ) : <span class="type">resource</span></div>
<p class="para rdfs-comment">
<span class="function"><strong>fbsql_connect()</strong></span> establishes a connection to a
FrontBase server.
</p>
<p class="para">
If a second call is made to <span class="function"><strong>fbsql_connect()</strong></span>
with the same arguments, no new link will be established, but
instead, the link identifier of the already opened link will be
returned.
</p>
<p class="para">
The link to the server will be closed as soon as the execution of
the script ends, unless it&#039;s closed earlier by explicitly calling
<span class="function"><a href="fbsql_close.html" class="function">fbsql_close()</a></span>.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.fbsql-connect-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">hostname</code></dt>
<dd>
<p class="para">
The server host name.
</p>
</dd>
<dt>
<code class="parameter">username</code></dt>
<dd>
<p class="para">
The user name for the connection.
</p>
</dd>
<dt>
<code class="parameter">password</code></dt>
<dd>
<p class="para">
The password for the connection.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.fbsql-connect-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
Returns a positive FrontBase link identifier on success, or <strong><code>FALSE</code></strong> on
errors.
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.fbsql-connect-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-1205">
<p><strong>Example #1 <span class="function"><strong>fbsql_connect()</strong></span> example</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$link&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fbsql_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"_SYSTEM"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"secret"</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;die(</span><span style="color: #DD0000">"Could&nbsp;not&nbsp;connect"</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #DD0000">"Connected&nbsp;successfully"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">fbsql_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.fbsql-connect-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="fbsql_pconnect.html" class="function" rel="rdfs-seeAlso">fbsql_pconnect()</a> - Open a persistent connection to a FrontBase Server</span></li>
<li class="member"><span class="function"><a href="fbsql_close.html" class="function" rel="rdfs-seeAlso">fbsql_close()</a> - Close FrontBase connection</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>