このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン 最新のリビジョン 両方とも次のリビジョン | ||
slim:4:middleware [2020/10/13 15:55] y2sunlight |
slim:4:middleware [2020/10/13 16:21] y2sunlight [Supported media types] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== Slim4 パッケージ化されたミドルウェア ====== | + | ====== Slim4 ミドルウェア ====== |
Version 4.5.0 | Version 4.5.0 | ||
行 362: | 行 362: | ||
Web APIでは、JSONまたはXML形式でデータを送信するのが非常に一般的です。箱から出しも、PSR-7の実装はこれらの形式をサポートしていません。リクエストオブジェクトの '' | Web APIでは、JSONまたはXML形式でデータを送信するのが非常に一般的です。箱から出しも、PSR-7の実装はこれらの形式をサポートしていません。リクエストオブジェクトの '' | ||
- | ==== Usage ==== | + | ==== 使用法 |
- | + | ||
- | It’s recommended to put the body parsing middleware before the call to addErrorMiddlware, | + | |
- | addErrorMiddlwareを呼び出す前に、本体解析ミドルウェアを配置して、スタックが次のようになるようにすることをお勧めします: | + | '' |
<code php> | <code php> | ||
行 391: | 行 389: | ||
\\ | \\ | ||
- | ==== Posted | + | ==== ポストされたJSON、フォーム、XMLデータ |
- | No changes are required to the POST handler because the BodyParsingMiddleware | + | POSTハンドラーを変更する必要はありません。というのは、'' |
- | '' | + | ブラウザからウェブサイトにポストされたデータの場合、$request の '' |
- | + | ||
- | For data posted to the website from a browser, you can use the $request’s getParsedBody() method. | + | |
- | + | ||
- | ブラウザからウェブサイトに投稿されたデータの場合、$request の '' | + | |
- | + | ||
- | This will return an array of the posted data. | + | |
これにより、投稿されたデータの配列が返されます。 | これにより、投稿されたデータの配列が返されます。 | ||
行 418: | 行 410: | ||
\\ | \\ | ||
- | ==== Media type detection | + | ==== メディアタイプの検出 |
* The middleware reads the Content-Type from the request header to detect the media type. | * The middleware reads the Content-Type from the request header to detect the media type. | ||
行 430: | 行 422: | ||
\\ | \\ | ||
- | ==== Supported media types ==== | + | ==== サポートされているメディアタイプ |
* application/ | * application/ | ||
行 439: | 行 431: | ||
\\ | \\ | ||
- | ===== Content Length | + | ===== Content Length ===== |
- | The Content Length | + | Content Length |
- | Content Length ミドルウェアは、'' | + | ==== 使用法 |
- | + | ||
- | ==== Usage ==== | + | |
<code php> | <code php> |