mirror of
https://github.com/php/doc-fr.git
synced 2026-03-24 07:02:06 +01:00
128 lines
3.5 KiB
XML
128 lines
3.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 3c84b0297195da8c0c2dad2d33f2c143dd3421b0 Maintainer: Fan2Shrek Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
<refentry xml:id="mongodb-bson-packedarray.fromjson" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>MongoDB\BSON\PackedArray::fromJSON</refname>
|
|
<refpurpose>Construit une nouvelle instance de tableau BSON à partir d'une chaîne JSON</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>final</modifier> <modifier>static</modifier> <modifier>public</modifier> <type>MongoDB\BSON\PackedArray</type><methodname>MongoDB\BSON\PackedArray::fromJSON</methodname>
|
|
<methodparam><type>string</type><parameter>json</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Convertit une chaîne
|
|
<link xlink:href="&url.mongodb.docs.extendedjson;">JSON étendu</link>
|
|
en sa représentation BSON.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>json</parameter> (<type>string</type>)</term>
|
|
<listitem>
|
|
<para>
|
|
La valeur JSON à convertir.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Renvoie une nouvelle instance de <classname>MongoDB\BSON\PackedArray</classname>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<simplelist>
|
|
&mongodb.throws.argumentparsing;
|
|
<member>
|
|
Lance une
|
|
<classname>MongoDB\Driver\Exception\UnexpectedValueException</classname> si
|
|
la valeur JSON ne peut pas être convertie en tableau BSON (par exemple, en raison
|
|
d'une erreur de syntaxe).
|
|
</member>
|
|
</simplelist>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title>Exemple de <methodname>MongoDB\BSON\PackedArray::fromJSON</methodname></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$json = '[ "foo", { "$numberInt" : "123" }, { "$numberLong" : "4294967295" }, { "$oid" : "56315a7c6118fd1b920270b1" } ]';
|
|
$packedArray = MongoDB\BSON\PackedArray::fromJSON($json);
|
|
var_dump($packedArray);
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
object(MongoDB\BSON\PackedArray)#1 (2) {
|
|
["data"]=>
|
|
string(68) "MQAAAAIwAAQAAABmb28AEDEAewAAABIyAP////8AAAAABzMAVjFafGEY/RuSAnCxAA=="
|
|
["value"]=>
|
|
array(4) {
|
|
[0]=>
|
|
string(3) "foo"
|
|
[1]=>
|
|
int(123)
|
|
[2]=>
|
|
int(4294967295)
|
|
[3]=>
|
|
object(MongoDB\BSON\ObjectId)#2 (1) {
|
|
["oid"]=>
|
|
string(24) "56315a7c6118fd1b920270b1"
|
|
}
|
|
}
|
|
}
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<simplelist>
|
|
<member><methodname>MongoDB\BSON\PackedArray::fromPHP</methodname></member>
|
|
<member><link xlink:href="&url.mongodb.docs.extendedjson;">Json étendu de MongoDB</link></member>
|
|
<member><link xlink:href="&url.mongodb.docs.bson;">Types BSON</link></member>
|
|
</simplelist>
|
|
</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
|
|
-->
|