Deferred
CoroutineGen::runNonBlocking(
function() : Generator {
$deferred = new Deferred(function() : Generator {
return yield file_get_contents('http://www.weather.com.cn/data/cityinfo/101270101.html');
});
$data = yield from $deferred->await();
var_dump($data);
},
function() : Generator {
yield var_dump("END!");
},
function() {
var_dump("START!");
},
function() {
var_dump("Hello World");
}
);Last updated