1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-26 00:32:15 +01:00
Files
archived-doc-ru/reference/strings/functions/stripslashes.xml
2024-03-23 01:30:15 +03:00

155 lines
3.8 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 8cdc6621f9826d04abc3e50438c010804d7e8683 Maintainer: shein Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.stripslashes" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>stripslashes</refname>
<refpurpose>Удаляет экранирование символов</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>stripslashes</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
</methodsynopsis>
<para>
Функция удаляет символы экранирования.
</para>
<para>
Функцией <function>stripslashes</function> пользуются,
когда не требуется экранирование символов.
Например, данные не вставляются в базу данных, а просто выводятся в
браузер.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>string</parameter></term>
<listitem>
<para>
Входная строка.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Функция возвращает строку с вырезанными обратными слешами,
<literal>\'</literal> становится <literal>'</literal> и т. п.
Двойные обратные слеши <literal>\\</literal> становятся одинарными
<literal>\</literal>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Пример использования функции <function>stripslashes</function></title>
<programlisting role="php">
<![CDATA[
<?php
$str = "Ваc зовут O\'reilly?";
// Выводит: Вас зовут O'reilly?
echo stripslashes($str);
?>
]]>
</programlisting>
</example>
</para>
<note>
<para>
Функция <function>stripslashes</function> нерекурсивна. Если требуется
применить функцию к многомерному массиву, то вызывают рекурсивную функцию.
</para>
</note>
<para>
<example>
<title>Пример работы функции <function>stripslashes</function> с массивом</title>
<programlisting role="php">
<![CDATA[
<?php
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
// Пример
$array = array("f\\'oo", "b\\'ar", array("fo\\'o", "b\\'ar"));
$array = stripslashes_deep($array);
// Вывод
print_r($array);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Array
(
[0] => f'oo
[1] => b'ar
[2] => Array
(
[0] => fo'o
[1] => b'ar
)
)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>addslashes</function></member>
<member><function>get_magic_quotes_gpc</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
-->