AWS PHP SDK Promise doesnt work

雨燕双飞 提交于 2019-12-11 12:23:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!