Base64-encodes the JSON string.
Access
public
Returns
Type |
Description |
|---|---|
|
The Base64-encoded version of the JSON string. |
Examples
Create a policy and get the Base64-encoded policy document.
// Instantiate S3
$s3 = new AmazonS3();
// Create a new S3 policy using an associative array
$policy = new s3Policy($s3, array(
'Version' => '2008-10-17',
'Statement' => array(
array( // Statement #1
'Sid' => 'AddPerm',
'Effect' => 'Allow',
'Principal' => array(
'AWS' => '*'
),
'Action' => array('s3:ReadObject'),
'Resource' => array('arn:aws:s3:::my-bucket/*')
)
)
));
// Success?
var_dump($policy->get_policy());
Result:
string(232) "eyJWZXJzaW9uIjoiMjAwOC0xMC0xNyIsIlN0YXRlbWVudCI6W3siU2lkIjoiQWRkUGVybSIsIkVmZmVjdCI6IkFsbG93IiwiUHJpbmNpcGFsIjp7IkFXUyI6IioifSwiQWN0aW9uIjpbInMzOlJlYWRPYmplY3QiXSwiUmVzb3VyY2UiOlsiYXJuOmF3czpzMzo6OmF3cy1waHAtc2RrLXRlc3RcLyoiXX1dfQ=="
Related Methods
Source
Method defined in utilities/policy.class.php | Toggle source view (4 lines) | View on GitHub

