我想在php中实现类似于控制器的东西,它接收像https://developers.google.com/drive/v3/web/manage-uploads#multipart
这样的东西POST /files HTTP/1.1
Host: my-foo-host
Content-Type: multipart/related; boundary=test
Content-Length: 226
--test
Content-Type: application/vnd.api+json; charset=UTF-8
{"data":{"some-meta-data-key":"some-meta-data-value"}}
--test
Content-Type: text/plain; charset=utf-8
Content-transfer-encoding: base64
UGNsYXNzIEZhcmUK
--test--
在PHP中是否有任何解决方案可以用来代替它并代表:
php > $requestData = get_data();
php > foreach ($requestData as $dataItem) {
php > echo $dataItem->getContentType() . PHP_EOL;
php > echo $dataItem->getBody() . PHP_EOL;
php > echo PHP_EOL;
php > }
application/vnd.api+json; charset=UTF-8
{"data":{"some-meta-data-key":"some-meta-data-value"}}
text/plain; charset=utf-8
UGNsYXNzIEZhcmUK