« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 1 of about 1 for StringValue (0.001 sec.)
JsonSerializable::jsonSerialize — JSON にシリアライズしたいデータを指定する | P... 9414
JsonSerializable::jsonSerialize (PHP 5 >= 5.4.0, PHP 7, PHP 8) JsonSerializable::jsonSerialize — JSON にシリアライズしたいデータを指定する 説明 public function JsonSerializable::jsonSerialize (): mixed オブジェクトをシリアライズして、 json_ ... SON_PRETTY_PRINT ); ?> 上の例の出力は以下となります。 1 例4 JsonSerializable::jsonSerialize() で文字列を返す例 <?php class StringValue implements JsonSerializable { private $string ; public function __construct ( $string ) { $this -> string = (string) $stri ... ng ; } public function jsonSerialize () { return $this -> string ; } } echo json_encode (new StringValue ( 'Hello!' ), JSON_PRETTY_PRINT ); ?> 上の例の出力は以下となります。 "Hello!" 他のマニュアルの関連ページ Python json DuckD ...
https://man.mtool.work/php/8.3/jsonserializable.jsonserialize.html
PREV 1 NEXT