InitiateMultipartUploadResult.php 593 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace OSS\Result;
  3. use OSS\Core\OssException;
  4. /**
  5. * Class initiateMultipartUploadResult
  6. * @package OSS\Result
  7. */
  8. class InitiateMultipartUploadResult extends Result
  9. {
  10. /**
  11. * 结果中获取uploadId并返回
  12. *
  13. * @throws OssException
  14. * @return string
  15. */
  16. protected function parseDataFromResponse()
  17. {
  18. $content = $this->rawResponse->body;
  19. $xml = simplexml_load_string($content);
  20. if (isset($xml->UploadId)) {
  21. return strval($xml->UploadId);
  22. }
  23. throw new OssException("cannot get UploadId");
  24. }
  25. }