问题
According to the promise feature: AWS PHP SDK V3 one should create a promise and the run the "then" function.
My code:
$promise = $client->copyObjectAsync($params);
$promise->then(function ($value) {
echo "The promise was fulfilled with {$value}";
}, function ($reason) {
echo "The promise was rejected with {$reason}";
});
but the promise doesnt run...(it stays in pending state) Only when i run the "wait" method (which is blocking) then the promise is executed. Do you have to use "wait" and if so why do i need async?
来源:https://stackoverflow.com/questions/33898455/aws-php-sdk-promise-doesnt-work