« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 3 of about 3 for myDocument (0.001 sec.)
MongoDB\BSON\Unserializable::bsonUnserialize — Constructs the object from a BSO... 11533
MongoDB\BSON\Unserializable::bsonUnserialize (mongodb >=1.0.0) MongoDB\BSON\Unserializable::bsonUnserialize — Constructs the object from a BSON array or document 説明 abstract public function MongoDB\BSON\Unserializable::bsonUnserialize ( a ... eviously declared as tentative are now enforced. 例 例1 MongoDB\BSON\Unserializable::bsonUnserialize() example <?php class MyDocument implements MongoDB\BSON\Unserializable { private $data = []; function bsonUnserialize (array $data ): void { $this -> data ... = $data ; } } $bson = MongoDB\BSON\Document :: fromJSON ( '{ "foo": "bar" }' ); var_dump ( $bson -> toPHP ([ 'root' => 'MyDocument' ])); ?> 上の例の出力は以下となります。 object(MyDocument)#1 (1) { ["data":"MyDocument":private]=> array(1) { ["foo"]=> st ...
https://man.mtool.work/php/8.3/mongodb-bson-unserializable.bsonunserialize.html
MongoDB\BSON\Serializable::bsonSerialize — Provides an array or document to ser... 9375
MongoDB\BSON\Serializable::bsonSerialize (mongodb >=1.0.0) MongoDB\BSON\Serializable::bsonSerialize — Provides an array or document to serialize as BSON 説明 abstract public function MongoDB\BSON\Serializable::bsonSerialize (): array | stdC ... ield value. 例 例1 MongoDB\BSON\Serializable::bsonSerialize() returning an associative array for root document <?php class MyDocument implements MongoDB\BSON\Serializable { private $id ; function __construct () { $this -> id = new MongoDB\BSON\ObjectId ; } ... bsonSerialize (): array { return [ '_id' => $this -> id , 'foo' => 'bar' ]; } } echo MongoDB\BSON\Document :: fromPHP (new MyDocument )-> toRelaxedExtendedJSON (), "\n" ; ?> 上の例の出力は、 たとえば以下のようになります。 { "_id" : { "$oid" : "56cccdcada14 ... 2, "2" : 3 } 例3 MongoDB\BSON\Serializable::bsonSerialize() returning an associative array for document field <?php class MyDocument implements MongoDB\BSON\Serializable { function bsonSerialize (): array { return [ 'foo' => 'bar' ]; } } $value = [ 'docum ...
https://man.mtool.work/php/8.3/mongodb-bson-serializable.bsonserialize.html
DOMDocument::registerNodeClass — 基底ノード型を作成する際に使用する拡張クラスを... 6975
DOMDocument::registerNodeClass (PHP 5 >= 5.2.0, PHP 7, PHP 8) DOMDocument::registerNodeClass — 基底ノード型を作成する際に使用する拡張クラスを登録する 説明 public function DOMDocument::registerNodeClass ( string $baseClass , ? string $extend ... t extends DOMElement { function appendElement ( $name ) { return $this -> appendChild (new myElement ( $name )); } } class myDocument extends DOMDocument { function setRoot ( $name ) { return $this -> appendChild (new myElement ( $name )); } } $doc = new m ...
https://man.mtool.work/php/8.3/domdocument.registernodeclass.html
PREV 1 NEXT