본문 바로가기
개발/aws

s3 getObject - 파일 내용 읽기

by 적아38 2022. 6. 4.
728x90
<?php
use Aws\S3\S3Client;

$s3Client = new S3Client([
	'version' => 'latest',
	'region' => #{region값. ap-northeast-2},
	'credentials' => array(
		'key' => #{aws 키값},
		'secret'  => #{aws secret값},
	)
]);

$result = $s3Client ->getObject([
	'Bucket' => #{사용하는 버킷명},
	'Key' => #{사용하고자 하는 파일명. 폴더/파일명, 파일명}'
]);

echo $result['Body'];
?>
728x90

댓글