mirror of
https://github.com/php/doc-ru.git
synced 2025-08-11 02:43:11 +00:00
129 lines
3.7 KiB
XML
129 lines
3.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- EN-Revision: 96c9d88bad9a7d7d44bfb7f26c226df7ee9ddf26 Maintainer: rjhdby Status: ready -->
|
||
<!-- Reviewed: no -->
|
||
<refentry xml:id="function.db2-escape-string" xmlns="http://docbook.org/ns/docbook">
|
||
<refnamediv>
|
||
<refname>db2_escape_string</refname>
|
||
<refpurpose>
|
||
Экранирует отдельные символы
|
||
</refpurpose>
|
||
</refnamediv>
|
||
|
||
<refsect1 role="description">
|
||
&reftitle.description;
|
||
<methodsynopsis>
|
||
<type>string</type><methodname>db2_escape_string</methodname>
|
||
<methodparam><type>string</type><parameter>string_literal</parameter></methodparam>
|
||
</methodsynopsis>
|
||
<para>
|
||
Функция добавляет обратные слеши перед специальными символами в строковом аргументе.
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="parameters">
|
||
&reftitle.parameters;
|
||
<para>
|
||
<variablelist>
|
||
<varlistentry>
|
||
<term><parameter>string_literal</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Строка, которая содержит символы, которые требуется экранировать.
|
||
Символы, которые необходимо экранировать:
|
||
<literal>\x00</literal>, <literal>\n</literal>,
|
||
<literal>\r</literal>, <literal>\</literal>,
|
||
<literal>'</literal>, <literal>"</literal>
|
||
и <literal>\x1a</literal>.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
</variablelist>
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="returnvalues">
|
||
&reftitle.returnvalues;
|
||
<para>
|
||
Функция возвращает параметр <parameter>string_literal</parameter>
|
||
с экранированными специальными символами.
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="examples">
|
||
&reftitle.examples;
|
||
<para>
|
||
<example>
|
||
<title>Пример использования функции <function>db2_escape_string</function></title>
|
||
<para>
|
||
Результат выполнения функции <function>db2_escape_string</function>
|
||
</para>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
|
||
$conn = db2_connect($database, $user, $password);
|
||
|
||
if ($conn) {
|
||
$str[0] = "All characters: \x00 , \n , \r , \ , ' , \" , \x1a .";
|
||
$str[1] = "Backslash (\). Single quote ('). Double quote (\")";
|
||
$str[2] = "The NULL character \0 must be quoted as well";
|
||
$str[3] = "Intersting characters: \x1a , \x00 .";
|
||
$str[4] = "Nothing to quote";
|
||
$str[5] = 200676;
|
||
$str[6] = "";
|
||
|
||
foreach( $str as $string ) {
|
||
echo "db2_escape_string: " . db2_escape_string($string). "\n";
|
||
}
|
||
}
|
||
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
&example.outputs;
|
||
<screen>
|
||
<![CDATA[
|
||
db2_escape_string: All characters: \0 , \n , \r , \\ , \' , \" , \Z .
|
||
db2_escape_string: Backslash (\\). Single quote (\'). Double quote (\")
|
||
db2_escape_string: The NULL character \0 must be quoted as well
|
||
db2_escape_string: Intersting characters: \Z , \0 .
|
||
db2_escape_string: Nothing to quote
|
||
db2_escape_string: 200676
|
||
db2_escape_string:
|
||
]]>
|
||
</screen>
|
||
</example>
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="seealso">
|
||
&reftitle.seealso;
|
||
<para>
|
||
<simplelist>
|
||
<member><function>db2_prepare</function></member>
|
||
</simplelist>
|
||
</para>
|
||
</refsect1>
|
||
|
||
</refentry>
|
||
<!-- Keep this comment at the end of the file
|
||
Local variables:
|
||
mode: sgml
|
||
sgml-omittag:t
|
||
sgml-shorttag:t
|
||
sgml-minimize-attributes:nil
|
||
sgml-always-quote-attributes:t
|
||
sgml-indent-step:1
|
||
sgml-indent-data:t
|
||
indent-tabs-mode:nil
|
||
sgml-parent-document:nil
|
||
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
||
sgml-exposed-tags:nil
|
||
sgml-local-catalogs:nil
|
||
sgml-local-ecat-files:nil
|
||
End:
|
||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||
vim: et tw=78 syn=sgml
|
||
vi: ts=1 sw=1
|
||
-->
|