LoginSignup
0
0

More than 1 year has passed since last update.

json_encode PHP 他言語に値を渡す

Posted at

用途

他言語に値を渡したいときに使う。

使用方法

JSONは、多様なプログラミング言語に対応するデータ記述言語。
JSONを使うことで言語関係なく値の受け渡しが可能になる。

書き方
json_encode($値, JSON定数);

※JSON定数は省略可能

json_encode($hoge);

日本語で変換

書き方
json_encode($値, JSON_UNESCAPED_UNICODE);

※JSON定数に JSON_UNESCAPED_UNICODE を指定する。

値ごとに改行して出力

書き方
json_encode($値, JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT);

※JSON定数に JSON_PRETTY_PRINT を指定する。
※日本語に変換するJSON定数と併用可能。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0