このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン 次のリビジョン 両方とも次のリビジョン | ||
slim:4:response [2020/10/07 21:10] y2sunlight [The Response Body] |
slim:4:response [2020/10/07 21:14] y2sunlight [Returning JSON] |
||
---|---|---|---|
行 151: | 行 151: | ||
\\ | \\ | ||
- | ===== The Response Body ===== | + | ===== レスポンスボディ |
HTTPレスポンスには通常、ボディがあります。 | HTTPレスポンスには通常、ボディがあります。 | ||
行 199: | 行 199: | ||
\\ | \\ | ||
- | ===== Returning | + | ===== JSONを返す |
- | In it’s simplest form, JSON data can be returned with a default 200 HTTP status code. | + | 最も単純な形式では、JSONデータはデフォルトの |
- | + | ||
- | 最も単純な形式では、JSONデータはデフォルトの200HTTPステータスコードで返すことができます。 | + | |
<code php> | <code php> | ||
行 213: | 行 211: | ||
-> | -> | ||
</ | </ | ||
- | |||
- | We can also return JSON data with a custom HTTP status code. | ||
カスタムHTTPステータスコードを使用してJSONデータを返すこともできます。 | カスタムHTTPステータスコードを使用してJSONデータを返すこともできます。 | ||
行 228: | 行 224: | ||
</ | </ | ||
- | > | ||
>The Response object is immutable. This method returns a copy of the Response object that has a new Content-Type header. This method is destructive, | >The Response object is immutable. This method returns a copy of the Response object that has a new Content-Type header. This method is destructive, | ||
- | > **リマインダー** | + | > **注意** |
- | > Responseオブジェクトは不変です。 このメソッドは、新しいContent-Typeヘッダーを持つResponseオブジェクトのコピーを返します。 このメソッドは破壊的であり、既存のContent-Typeヘッダーを置き換えます。 | + | > Responseオブジェクトは不変です。このメソッドは、新しいContent-Typeヘッダーを持つResponseオブジェクトのコピーを返します。このメソッドは破壊的であり、既存のContent-Typeヘッダーを置き換えます。 |
\\ | \\ |