svn: /phpdoc/ro/trunk/reference/json/functions/ json-last-error.xml

From: Date: Mon, 14 Sep 2009 09:10:33 +0000
Subject: svn: /phpdoc/ro/trunk/reference/json/functions/ json-last-error.xml
Groups: php.doc.ro 
Request: Send a blank email to doc-ro+get-748@lists.php.net to get a copy of this message
simionea Mon, 14 Sep 2009 09:10:33 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=288318 Log: Translated the file. Changed paths: A phpdoc/ro/trunk/reference/json/functions/json-last-error.xml Added: phpdoc/ro/trunk/reference/json/functions/json-last-error.xml =================================================================== --- phpdoc/ro/trunk/reference/json/functions/json-last-error.xml (rev 0) +++ phpdoc/ro/trunk/reference/json/functions/json-last-error.xml 2009-09-14 09:10:33 UTC (rev 288318) @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- $Revision: 283820 $ --> +<!-- EN-Revision: 283820 Maintainer: radical Status: ready --> +<!-- CREDITS: simionea --> +<refentry xml:id="function.json-last-error" xmlns="http://docbook.org/ns/docbook"> + <refnamediv> + <refname>json_last_error</refname> + <refpurpose>Întoarce ultima eroare ce a survenit</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>int</type><methodname>json_last_error</methodname> + <void /> + </methodsynopsis> + <para> + Întoarce ultima eroare (dacă este prezentă) care a survenit la interpretarea + JSON. + </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + &no.function.parameters; + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + Întoarce un întreg. Valoarea poate fi una din următoarele constante: + </para> + <table> + <title>Codurile de eroare JSON</title> + <tgroup cols="2"> + <thead> + <row> + <entry>Constantă</entry> + <entry>Semnificație</entry> + </row> + </thead> + <tbody> + <row> + <entry><constant>JSON_ERROR_NONE</constant></entry> + <entry>Nu a survenit vre-o eroare</entry> + </row> + <row> + <entry><constant>JSON_ERROR_DEPTH</constant></entry> + <entry>A fost depășită limita maximă de imbricare</entry> + </row> + <row> + <entry><constant>JSON_ERROR_CTRL_CHAR</constant></entry> + <entry>Eroare a caracterului de control, posibil este codificat incorect</entry> + </row> + <row> + <entry><constant>JSON_ERROR_SYNTAX</constant></entry> + <entry>Eroare de sintaxă</entry> + </row> + </tbody> + </tgroup> + </table> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Exemplu <function>json_last_error</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +// Un string JSON valid +$json[] = '{"Organization": "PHP Documentation Team"}'; + +// Un string JSON invalid ce va cauza o eroare de sintaxă +// în acest caz am utilizat ' în loc de " pentru citație +$json[] = "{'Organization': 'PHP Documentation Team'}"; + + +foreach($json as $string) +{ + echo 'Decoding: ' . $string; + json_decode($string); + + switch(json_last_error()) + { + case JSON_ERROR_DEPTH: + echo ' - Maximum stack depth exceeded'; + break; + case JSON_ERROR_CTRL_CHAR: + echo ' - Unexpected control character found'; + break; + case JSON_ERROR_SYNTAX: + echo ' - Syntax error, malformed JSON'; + break; + case JSON_ERROR_NONE: + echo ' - No errors'; + break; + } + + echo PHP_EOL; +} +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +Decoding: {"Organization": "PHP Documentation Team"} - No errors +Decoding: {'Organization': 'PHP Documentation Team'} - Syntax error, malformed JSON +]]> + </screen> + </example> + </para> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>json_decode</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:"../../../../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.ro (#748) next »