<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.uodbc.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.odbc-connection-string-quote.php',
    1 => 'odbc_connection_string_quote',
    2 => 'Quotes an ODBC connection string value',
  ),
  'up' => 
  array (
    0 => 'ref.uodbc.php',
    1 => 'ODBC 函数',
  ),
  'prev' => 
  array (
    0 => 'function.odbc-connection-string-is-quoted.php',
    1 => 'odbc_connection_string_is_quoted',
  ),
  'next' => 
  array (
    0 => 'function.odbc-connection-string-should-quote.php',
    1 => 'odbc_connection_string_should_quote',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/uodbc/functions/odbc-connection-string-quote.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.odbc-connection-string-quote" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">odbc_connection_string_quote</h1>
  <p class="verinfo">(PHP 8 &gt;= 8.2.0)</p><p class="refpurpose"><span class="refname">odbc_connection_string_quote</span> &mdash; <span class="dc-title">Quotes an ODBC connection string value</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.odbc-connection-string-quote-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>odbc_connection_string_quote</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$str</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Quotes a value for a connection string, according to ODBC rules.
   That is, it will be surrounded by quotes, and any ending curly
   braces will be escaped. This should be done for any connection
   string values that come from user input. Not doing so can lead
   to issues with parsing the connection string, or values being
   injected into the connection string.
  </p>
  <p class="para">
   Note that this function does not check if the string is already
   quoted, nor if the string needs quoting. For that, call
   <span class="function"><a href="function.odbc-connection-string-is-quoted.php" class="function">odbc_connection_string_is_quoted()</a></span> and
   <span class="function"><a href="function.odbc-connection-string-should-quote.php" class="function">odbc_connection_string_should_quote()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.odbc-connection-string-quote-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">str</code></dt>
    <dd>
     <p class="para">
      The unquoted string.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.odbc-connection-string-quote-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   A quoted string, surrounded by curly braces, and properly escaped.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.odbc-connection-string-quote-examples">
  <h3 class="title">示例</h3>
  <div class="example" id="odbc-connection-string-quote.example.basic">
   <p><strong>示例 #1 <span class="function"><strong>odbc_connection_string_quote()</strong></span> example</strong></p>
   <div class="example-contents"><p>
    This example quotes a string, then puts it in a connection string.
    Note that the string is quoted, and the ending quote character in
    the middle of the string has been escaped.
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$value </span><span style="color: #007700">= </span><span style="color: #0000BB">odbc_connection_string_quote</span><span style="color: #007700">(</span><span style="color: #DD0000">"foo}bar"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$connection_string </span><span style="color: #007700">= </span><span style="color: #DD0000">"DSN=PHP;UserValue=</span><span style="color: #0000BB">$value</span><span style="color: #DD0000">"</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">$connection_string</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>以上示例的输出类似于：</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">DSN=PHP;UserValue={foo}}bar}</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.odbc-connection-string-quote-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.odbc-connection-string-is-quoted.php" class="function" rel="rdfs-seeAlso">odbc_connection_string_is_quoted()</a> - Determines if an ODBC connection string value is quoted</span></li>
    <li><span class="function"><a href="function.odbc-connection-string-should-quote.php" class="function" rel="rdfs-seeAlso">odbc_connection_string_should_quote()</a> - Determines if an ODBC connection string value should be quoted</span></li>
   </ul>
  </p>
 </div>



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