cvs: phpdoc-pl /reference/json/functions json-last-error.xml

From: Date: Sat, 10 Jan 2009 13:01:34 +0000
Subject: cvs: phpdoc-pl /reference/json/functions json-last-error.xml
Groups: php.doc.pl 
Request: Send a blank email to doc-pl+get-1475@lists.php.net to get a copy of this message
joeaccord Sat Jan 10 13:01:34 2009 UTC Added files: /phpdoc-pl/reference/json/functions json-last-error.xml Log: new file http://cvs.php.net/viewvc.cgi/phpdoc-pl/reference/json/functions/json-last-error.xml?view=markup&rev=1.1 Index: phpdoc-pl/reference/json/functions/json-last-error.xml +++ phpdoc-pl/reference/json/functions/json-last-error.xml <?xml version="1.0" encoding="iso-8859-2"?> <!-- EN-Revision: 1.4 Maintainer: joeaccord Status: ready --> <!-- $Revision: 1.1 $ --> <refentry xml:id="function.json-last-error" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>json_last_error</refname> <refpurpose>Zwraca ostatni b³±d JSON</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>json_last_error</methodname> <void /> </methodsynopsis> <para> Zwraca ostatni b³±d, który wyst±pi³ podaczas parsowania JSON. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; &no.function.parameters; </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Zwaraca kod b³êdu jako integer. Warto¶æ mo¿e byæ jedn± z nastêpuj±cych sta³ych: </para> <table> <title>JSON error codes</title> <tgroup cols="2"> <thead> <row> <entry>Sta³a</entry> <entry>Znaczenie</entry> </row> </thead> <tbody> <row> <entry><constant>JSON_ERROR_NONE</constant></entry> <entry>Nie wyst±pi³ ¿aden b³±d</entry> </row> <row> <entry><constant>JSON_ERROR_DEPTH</constant></entry> <entry>Przekroczono maksymalny poziom zagnie¿d¿enia danych</entry> </row> <row> <entry><constant>JSON_ERROR_CTRL_CHAR</constant></entry> <entry>B³±d znaku kontrolnego. Prawdopodobnie zosta³ nieprawid³owo zakodowany</entry> </row> <row> <entry><constant>JSON_ERROR_SYNTAX</constant></entry> <entry>B³±d sk³adni</entry> </row> </tbody> </tgroup> </table> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>Przyk³ad <function>json_last_error</function></title> <programlisting role="php"> <![CDATA[ <?php // Prawid³owy ³añcuch znaków JSON $json[] = '{"Organizacja": "PHP Documentation Team"}'; // Nieprawid³owy ³añcuch znaków JSON spowoduje b³±d sk³adni. // W tym przypadku zosta³ u¿yty znak ' zamiast " $json[] = "{'Organizacja': 'PHP Documentation Team'}"; foreach($json as $string) { echo 'Dekodowanie: ' . $string; json_decode($string); switch(json_last_error()) { case JSON_ERROR_DEPTH: echo ' - Przekroczono maksymalny poziom zagnie¿d¿ania danych'; break; case JSON_ERROR_CTRL_CHAR: echo ' - Znaleziono niespodziewany znak kontrolny'; break; case JSON_ERROR_SYNTAX: echo ' - B³±d sk³adni. ¬le skonstruowany JSON'; break; case JSON_ERROR_NONE: echo ' - Brak b³êdów'; break; } echo PHP_EOL; } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ Decoding: {"Organizacja": "PHP Documentation Team"} - Brak b³êdów Decoding: {'Organizacja': 'PHP Documentation Team'} - B³±d sk³adni. ¬le skonstruowany 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.pl (#1475) next »