cvs: phpdoc-da /reference/strings/functions addslashes.xml

From: Date: Fri, 23 Jul 2004 20:55:27 +0000
Subject: cvs: phpdoc-da /reference/strings/functions addslashes.xml
Groups: php.doc.da 
Request: Send a blank email to doc-da+get-129@lists.php.net to get a copy of this message
tomsommer Fri Jul 23 16:55:27 2004 EDT Added files: /phpdoc-da/reference/strings/functions addslashes.xml Log: Initial translation http://cvs.php.net/co.php/phpdoc-da/reference/strings/functions/addslashes.xml?r=1.1&p=1 Index: phpdoc-da/reference/strings/functions/addslashes.xml +++ phpdoc-da/reference/strings/functions/addslashes.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.3 Maintainer: tomsommer Status: ready --> <refentry id="function.addslashes"> <refnamediv> <refname>addslashes</refname> <refpurpose>Beskyt en streng med slashes</refpurpose> </refnamediv> <refsect1> <title>Beskrivelse</title> <methodsynopsis> <type>string</type><methodname>addslashes</methodname> <methodparam><type>string</type><parameter>str</parameter></methodparam> </methodsynopsis> <para> Returnerer en streng med backslashes før tegn der skal beskyttes i en database forespørgsel mm. Disse tegn er enkelte citationstegn (<literal>'</literal>), dobbelte citationstegn (<literal>"</literal>), backslash (<literal>\</literal>) og NUL (&null; byte). </para> <para> Et eksempel på brug af <function>addslashes</function> er når du indsætter data ind i en database. For eksempel, for at indsætte navnet <literal>O'reilly</literal> ind i databasen, er du nød til at beskytte det. De fleste databaser gør dette med en <literal>\</literal> hvilket ville betyde <literal>O\'reilly</literal>. Dette vil kun være for at få dataene ind i databasen, det ekstra <literal>\</literal> vil ikke blive indsat. Hvis du har sat PHP direktivet <link linkend="ini.magic-quotes-sybase"> magic_quotes_sybase</link> til <literal>on</literal> vil dette betyde at <literal>'</literal> er i stedet beskyttet med en anden <literal>'</literal>. </para> <para> PHP Direktivet <link linkend="ini.magic-quotes-gpc"> magic_quotes_gpc</link> er som standard sat til <literal>on</literal>, og kører i bund og grund <function>addslashes</function> på alle GET, POST, og COOKIE data. Brug ikke <function>addslashes</function> på strenge der allerede er blevet beskyttet med <link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link> da du så vil lave dobbeltbeskyttelse. Funktionen <function>get_magic_quotes_gpc</function> er nyttig til at checke dette med. </para> <para> <example> <title>et <function>addslashes</function> eksempel</title> <programlisting role="php"> <![CDATA[ <?php $str = "Er dit navn O'reilly?"; // Udskriver: Er dit navn O\'reilly? echo addslashes($str); ?> ]]> </programlisting> </example> </para> <para> Se også <function>stripslashes</function>, <function>htmlspecialchars</function>, <function>quotemeta</function>, og <function>get_magic_quotes_gpc</function>. </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:"../../../../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 -->

« previous php.doc.da (#129) next »