mirror of
https://github.com/php/doc-ru.git
synced 2025-07-24 09:59:46 +00:00
upd
git-svn-id: https://svn.php.net/repository/phpdoc/ru/trunk@343169 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
@ -1,202 +1,210 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 41f14ef421ced23b42a1d792228c47f0ecb825df Maintainer: tmn Status: ready -->
|
||||
<!-- Reviewed: no -->
|
||||
<!-- $Revision$ -->
|
||||
<refentry xml:id="mysqli.real-escape-string" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>mysqli::real_escape_string</refname>
|
||||
<refname>mysqli_real_escape_string</refname>
|
||||
<refpurpose>
|
||||
Экранирует специальные символы в строке для использования в SQL выражении,
|
||||
используя текущий набор символов соединения
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="oop">
|
||||
<type>string</type><methodname>mysqli::escape_string</methodname>
|
||||
<methodparam><type>string</type><parameter>escapestr</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>mysqli::real_escape_string</methodname>
|
||||
<methodparam><type>string</type><parameter>escapestr</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>mysqli_real_escape_string</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>link</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>escapestr</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Эта функция используется для создания допустимых в SQL строк, которые можно
|
||||
использовать в SQL выражениях. Заданная строка кодируется в экранированную SQL
|
||||
строку, используя текущий набор символов подключения.
|
||||
</para>
|
||||
<caution>
|
||||
<title>Безопасность: набор символов по умолчанию</title>
|
||||
<para>
|
||||
Набор символов должен быть задан либо на стороне сервера, либо с помощью
|
||||
API функции <function>mysqli_set_charset</function>. В противном случае
|
||||
<function>mysqli_real_escape_string</function> работать не будет. За
|
||||
дополнительной информацией обращайтесь к документации
|
||||
<link linkend="mysqlinfo.concepts.charset">наборы символов</link>.
|
||||
</para>
|
||||
</caution>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
<varlistentry>
|
||||
<term><parameter>escapestr</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Строка, которую требуется экранировать.
|
||||
</para>
|
||||
<para>
|
||||
Экранируемые символы <literal>NUL (ASCII 0), \n, \r, \, ', ", и
|
||||
Control-Z</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Возвращает экранированную строку.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title>Пример использования <methodname>mysqli::real_escape_string</methodname></title>
|
||||
<para>&style.oop;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
|
||||
|
||||
/* проверка соединения */
|
||||
if (mysqli_connect_errno()) {
|
||||
printf("Не удалось подключиться: %s\n", mysqli_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$mysqli->query("CREATE TEMPORARY TABLE myCity LIKE City");
|
||||
|
||||
$city = "'s Hertogenbosch";
|
||||
|
||||
/* этот запрос вызовет ошибку, так как мы не экранировали $city */
|
||||
if (!$mysqli->query("INSERT into myCity (Name) VALUES ('$city')")) {
|
||||
printf("Ошибка: %s\n", $mysqli->sqlstate);
|
||||
}
|
||||
|
||||
$city = $mysqli->real_escape_string($city);
|
||||
|
||||
/* этот запрос отработает нормально */
|
||||
if ($mysqli->query("INSERT into myCity (Name) VALUES ('$city')")) {
|
||||
printf("%d строк вставлено.\n", $mysqli->affected_rows);
|
||||
}
|
||||
|
||||
$mysqli->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>&style.procedural;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
|
||||
|
||||
/* проверка соединения */
|
||||
if (mysqli_connect_errno()) {
|
||||
printf("Не удалось подключиться: %s\n", mysqli_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
mysqli_query($link, "CREATE TEMPORARY TABLE myCity LIKE City");
|
||||
|
||||
$city = "'s Hertogenbosch";
|
||||
|
||||
/* этот запрос вызовет ошибку, так как мы не экранировали $city */
|
||||
if (!mysqli_query($link, "INSERT into myCity (Name) VALUES ('$city')")) {
|
||||
printf("Ошибка: %s\n", mysqli_sqlstate($link));
|
||||
}
|
||||
|
||||
$city = mysqli_real_escape_string($link, $city);
|
||||
|
||||
/* этот запрос отработает нормально */
|
||||
if (mysqli_query($link, "INSERT into myCity (Name) VALUES ('$city')")) {
|
||||
printf("%d строк вставлено.\n", mysqli_affected_rows($link));
|
||||
}
|
||||
|
||||
mysqli_close($link);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Ошибка: 42000
|
||||
1 строк вставлено.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
Тем, кто привык использовать функцию
|
||||
<function>mysql_real_escape_string</function>,
|
||||
следует обратить внимание, что аргументы
|
||||
<function>mysqli_real_escape_string</function> отличаются от аргументов
|
||||
<function>mysql_real_escape_string</function>. Идентификатор
|
||||
<parameter>link</parameter> в <function>mysqli_real_escape_string</function>
|
||||
идет первым, в то время как в <function>mysql_real_escape_string</function>
|
||||
первой идет экранируемая строка.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_set_charset</function></member>
|
||||
<member><function>mysqli_character_set_name</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
|
||||
-->
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 61cac7f581eabf91985343c5c83f845f74f3cdd3 Maintainer: tmn Status: ready -->
|
||||
<!-- Reviewed: no -->
|
||||
<!-- $Revision$ -->
|
||||
<refentry xml:id="mysqli.real-escape-string" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>mysqli::real_escape_string</refname>
|
||||
<refname>mysqli_real_escape_string</refname>
|
||||
<refpurpose>
|
||||
Экранирует специальные символы в строке для использования в SQL выражении,
|
||||
используя текущий набор символов соединения
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="oop">
|
||||
<type>string</type><methodname>mysqli::escape_string</methodname>
|
||||
<methodparam><type>string</type><parameter>escapestr</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>mysqli::real_escape_string</methodname>
|
||||
<methodparam><type>string</type><parameter>escapestr</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>mysqli_real_escape_string</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>link</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>escapestr</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Эта функция используется для создания допустимых в SQL строк, которые можно
|
||||
использовать в SQL выражениях. Заданная строка кодируется в экранированную SQL
|
||||
строку, используя текущий набор символов подключения.
|
||||
</para>
|
||||
<caution>
|
||||
<title>Безопасность: набор символов по умолчанию</title>
|
||||
<para>
|
||||
Набор символов должен быть задан либо на стороне сервера, либо с помощью
|
||||
API функции <function>mysqli_set_charset</function>. В противном случае
|
||||
<function>mysqli_real_escape_string</function> работать не будет. За
|
||||
дополнительной информацией обращайтесь к документации
|
||||
<link linkend="mysqlinfo.concepts.charset">наборы символов</link>.
|
||||
</para>
|
||||
</caution>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
<varlistentry>
|
||||
<term><parameter>escapestr</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Строка, которую требуется экранировать.
|
||||
</para>
|
||||
<para>
|
||||
Экранируемые символы <literal>NUL (ASCII 0), \n, \r, \, ', ", и
|
||||
Control-Z</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Возвращает экранированную строку.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="errors">
|
||||
&reftitle.errors;
|
||||
<para>
|
||||
Использование этой функции без корректного идентификатора соединения
|
||||
вернет &null; и вызовет ошибку уровня <constant>E_WARNING</constant>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title>Пример использования <methodname>mysqli::real_escape_string</methodname></title>
|
||||
<para>&style.oop;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
|
||||
|
||||
/* проверка соединения */
|
||||
if (mysqli_connect_errno()) {
|
||||
printf("Не удалось подключиться: %s\n", mysqli_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$mysqli->query("CREATE TEMPORARY TABLE myCity LIKE City");
|
||||
|
||||
$city = "'s Hertogenbosch";
|
||||
|
||||
/* этот запрос вызовет ошибку, так как мы не экранировали $city */
|
||||
if (!$mysqli->query("INSERT into myCity (Name) VALUES ('$city')")) {
|
||||
printf("Ошибка: %s\n", $mysqli->sqlstate);
|
||||
}
|
||||
|
||||
$city = $mysqli->real_escape_string($city);
|
||||
|
||||
/* этот запрос отработает нормально */
|
||||
if ($mysqli->query("INSERT into myCity (Name) VALUES ('$city')")) {
|
||||
printf("%d строк вставлено.\n", $mysqli->affected_rows);
|
||||
}
|
||||
|
||||
$mysqli->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>&style.procedural;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
|
||||
|
||||
/* проверка соединения */
|
||||
if (mysqli_connect_errno()) {
|
||||
printf("Не удалось подключиться: %s\n", mysqli_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
mysqli_query($link, "CREATE TEMPORARY TABLE myCity LIKE City");
|
||||
|
||||
$city = "'s Hertogenbosch";
|
||||
|
||||
/* этот запрос вызовет ошибку, так как мы не экранировали $city */
|
||||
if (!mysqli_query($link, "INSERT into myCity (Name) VALUES ('$city')")) {
|
||||
printf("Ошибка: %s\n", mysqli_sqlstate($link));
|
||||
}
|
||||
|
||||
$city = mysqli_real_escape_string($link, $city);
|
||||
|
||||
/* этот запрос отработает нормально */
|
||||
if (mysqli_query($link, "INSERT into myCity (Name) VALUES ('$city')")) {
|
||||
printf("%d строк вставлено.\n", mysqli_affected_rows($link));
|
||||
}
|
||||
|
||||
mysqli_close($link);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Ошибка: 42000
|
||||
1 строк вставлено.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
Тем, кто привык использовать функцию
|
||||
<function>mysql_real_escape_string</function>,
|
||||
следует обратить внимание, что аргументы
|
||||
<function>mysqli_real_escape_string</function> отличаются от аргументов
|
||||
<function>mysql_real_escape_string</function>. Идентификатор
|
||||
<parameter>link</parameter> в <function>mysqli_real_escape_string</function>
|
||||
идет первым, в то время как в <function>mysql_real_escape_string</function>
|
||||
первой идет экранируемая строка.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_set_charset</function></member>
|
||||
<member><function>mysqli_character_set_name</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
|
||||
-->
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision$ -->
|
||||
<!-- EN-Revision: b2c1d554c77513daa8948351dcd1c030ea2898d1 Maintainer: rjhdby Status: ready -->
|
||||
<!-- EN-Revision: 3b19d69c48fe451a93d7271b0ae7dc09497d739b Maintainer: rjhdby Status: ready -->
|
||||
<!-- Reviewed: no -->
|
||||
|
||||
<sect1 xml:id="opcache.configuration" xmlns="http://docbook.org/ns/docbook">
|
||||
@ -182,6 +182,30 @@
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="ini.opcache.file_update_protection">opcache.file_update_protection</link></entry>
|
||||
<entry>"2"</entry>
|
||||
<entry>PHP_INI_ALL</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="ini.opcache.huge_code_pages">opcache.huge_code_pages</link></entry>
|
||||
<entry>"0"</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="ini.opcache.lockfile_path">opcache.lockfile_path</link></entry>
|
||||
<entry>"/tmp"</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="ini.opcache.opt_debug_level">opcache.opt_debug_level</link></entry>
|
||||
<entry>"0"</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="ini.opcache.file-cache">opcache.file_cache</link></entry>
|
||||
<entry>NULL</entry>
|
||||
@ -621,6 +645,58 @@
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="ini.opcache.file_update_protection">
|
||||
<term>
|
||||
<parameter>opcache.file_update_protection</parameter>
|
||||
<type>string</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Предотвращает кеширование файлов младше указанного количества секунд.
|
||||
Это помогает предотвратить кеширование не до конца обновленных файлов.
|
||||
В случае, если у вас все обновления файлов атомарны, можно повысить
|
||||
производительность задав этот параметр равным "0".
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="ini.opcache.huge_code_pages">
|
||||
<term>
|
||||
<parameter>opcache.huge_code_pages</parameter>
|
||||
<type>string</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Включает или отключает копирование кода PHP (текстового сегмента) в HUGE PAGES.
|
||||
Это может повысить производительность, но требует соответствующих системных
|
||||
настроек.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="ini.opcache.lockfile_path">
|
||||
<term>
|
||||
<parameter>opcache.lockfile_path</parameter>
|
||||
<type>string</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Абсолютный путь к хранилищу общих лок-файлов (только *nix)
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="ini.opcache.opt_debug_level">
|
||||
<term>
|
||||
<parameter>opcache.opt_debug_level</parameter>
|
||||
<type>string</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Производит вывод опкодов для отладки разных этапов оптимизации.
|
||||
0x10000 приведет к выводу опкодов как только они сгенерированы компилятором, до
|
||||
применения какой либо оптимизации.
|
||||
0x20000 приведет к выводу опкодов после оптимизации.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="ini.opcache.file-cache">
|
||||
<term>
|
||||
<parameter>opcache.file_cache</parameter>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: ead61e4ed793b633a433566b9e8416d17ae2cd4f Maintainer: shein Status: ready -->
|
||||
<!-- EN-Revision: a468efb805ddae9bd886a92c1c313e92b737abe0 Maintainer: shein Status: ready -->
|
||||
<!-- Reviewed: yes -->
|
||||
<!-- $Revision$ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.sprintf">
|
||||
|
Reference in New Issue
Block a user