1
0
mirror of https://github.com/php/doc-tr.git synced 2026-04-26 00:18:08 +02:00
Files
2021-05-22 12:20:53 +03:00

250 lines
6.4 KiB
XML
Raw Permalink 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: nilgun Status: ready -->
<!-- CREDITS: ecamalan -->
<refentry xml:id="function.json-last-error" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>json_last_error</refname>
<refpurpose>Oluşan son hatayı döndürür.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>json_last_error</methodname>
<void />
</methodsynopsis>
<para>
<constant>JSON_THROW_ON_ERROR</constant> belirtilmeden yapılan son JSON
şifre/deşifre işlemi sırasında (varsa) oluşan son hatayı döndürür.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Tamsayı döndürür, ve değeri aşağıdaki sabitler olabilir:
</para>
<table>
<title>JSON hata kodları</title>
<tgroup cols="2">
<thead>
<row>
<entry>Sabit</entry>
<entry>Anlamı</entry>
<entry>Geçerlilik</entry>
</row>
</thead>
<tbody>
<row>
<entry><constant>JSON_ERROR_NONE</constant></entry>
<entry>Hata bulunamadı</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_DEPTH</constant></entry>
<entry>Azami yığın derinliği aşıldı</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_STATE_MISMATCH</constant></entry>
<entry>Geçersiz ya da bozuk JSON</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_CTRL_CHAR</constant></entry>
<entry>Denetim karakteri hatası, muhtemelen yanlış kodlanmış</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_SYNTAX</constant></entry>
<entry>Sözdizimi hatası</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_UTF8</constant></entry>
<entry>Bozuk UTF-8 karakterler, muhtemelen yanlış kodlanmış</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_RECURSION</constant></entry>
<entry>Kodlanacak değerde bir veya daha fazla özyinelemeli gönderim</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_INF_OR_NAN</constant></entry>
<entry>
Kodlanacak değerde bir veya daha fazla
<link linkend="language.types.float.nan"><constant>NAN</constant></link>
veya <link linkend="function.is-infinite"><constant>INF</constant></link>
değeri
</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_UNSUPPORTED_TYPE</constant></entry>
<entry>Kodlanamayan türde bir değer belirtilmiş</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_INVALID_PROPERTY_NAME</constant></entry>
<entry>Kodlanamayan bir özellik ismi belirtilmiş</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_UTF16</constant></entry>
<entry>Bozuk UTF-16 karakterler, muhtemelen yanlış kodlanmış</entry>
<entry></entry>
</row>
</tbody>
</tgroup>
</table>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>json_last_error</function> örneği</title>
<programlisting role="php">
<![CDATA[
<?php
// Geçerli json dizgesi
$json[] = '{"Organization": "PHP Documentation Team"}';
// Geçersiz json dizgesi sözdizimi hatasına sebep
// olur, bu durumda biz tırnak için ' yerine "
// kullanırız
$json[] = "{'Organization': 'PHP Documentation Team'}";
foreach ($json as $string) {
echo 'Decoding: ' . $string;
json_decode($string);
switch (json_last_error()) {
case JSON_ERROR_NONE:
echo ' - No errors';
break;
case JSON_ERROR_DEPTH:
echo ' - Azami yığın derinliği aşıldı';
break;
case JSON_ERROR_STATE_MISMATCH:
echo ' - Alttan taşma ya da kipler uyumsuz';
break;
case JSON_ERROR_CTRL_CHAR:
echo ' - Beklenmeyen kontol karakteri bulundu';
break;
case JSON_ERROR_SYNTAX:
echo ' - Sözdizimi hatası, kusurlu JSON';
break;
case JSON_ERROR_UTF8:
echo ' - Bozuk UTF-8 karakterler, muhtemelen yanlış kodlanmış';
break;
default:
echo ' - Bilinmeyen hata';
break;
}
echo PHP_EOL;
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Decoding: {"Organization": "PHP Documentation Team"} - Hatasız
Decoding: {'Organization': 'PHP Documentation Team'} - Sözdizimi hatası, kusurlu JSON
]]>
</screen>
</example>
</para>
<para>
<example>
<title>- <function>json_last_error</function> ile
<function>json_encode</function></title>
<programlisting role="php">
<![CDATA[
<?php
// Geçersiz UTF8 dizesi
$text = "\xB1\x31";
$json = json_encode($text);
$error = json_last_error();
var_dump($json, $error === JSON_ERROR_UTF8);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
string(4) "null"
bool(true)
]]>
</screen>
</example>
</para>
<para>
<example>
<title>- <function>json_last_error</function> ve <constant>JSON_THROW_ON_ERROR</constant></title>
<programlisting role="php">
<![CDATA[
<?php
// JSON_ERROR_UTF8'e sebep olan geçersiz UTF8 dizesi
json_encode("\xB1\x31");
// Bu bir JSON hatası oluşturmaz
json_encode('okay', JSON_THROW_ON_ERROR);
// Küresel hata durumu eski json_encode() tarafından değiştirilmemiş
var_dump(json_last_error() === JSON_ERROR_UTF8);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(true)
]]>
</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:"~/.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
-->