异步调用(Asynchronous)

通过 Phalcon\Async 我们可以异步调用方法。

异步调用(Called asynchronous)

  1. <?php
  2.  
  3. $id1 = Phalcon\Async::call(function () {
  4. return 'one1';
  5. });
  6. $id2 = Phalcon\Async::call(function () {
  7. return 'one2';
  8. });

获取异步调用结果个数(Gets result count)

  1. <?php
  2.  
  3. $num = Phalcon\Async::count();

获取异步调用结果(Gets asynchronous result)

  1. <?php
  2.  
  3. $ret = Phalcon\Async::recv($id1);
  4. $rets = Phalcon\Async::recvAll();

原文: http://www.myleftstudio.com/reference/async.html