update : 2015.11.03
php.shukuma.com

검색:
 
 
Returns the JSON representation of a BSON value

MongoDB\BSON\toJSON

(mongodb >=1.0.0)

MongoDB\BSON\toJSONReturns the JSON representation of a BSON value

설명

string MongoDB\BSON\toJSON ( string $bson )

Converts a BSON string to its » extended JSON representation.

인수

bson (string)

BSON value to be converted.

반환값

The converted JSON value. NULL is returned on error.

예제

Example #1 MongoDB\BSON\toJSON() example

<?php

$document 
= ['_id' => new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1')];
$bson MongoDB\BSON\fromPHP($document);
echo 
MongoDB\BSON\toJSON($bson), "\n";

?>

위 예제의 출력:

{ "_id" : { "$oid" : "56315a7c6118fd1b920270b1" } }

참고