PHP 中的异步方法执行

Asynchronous method exec in PHP

我需要在 PHP 中启动一个异步方法调用,但不知道如何实现这一点。大思路如下:

public myfunctionAction() {
    // normal flow
    // execute the asynchronous call (WS)
    // continue normal flow
}

我该怎么做?任何人都可以提供一个简单的例子作为起点吗?是否可以让异步调用在后台执行并继续正常流程?

我正在使用 Symfony 2。6.x 作为开发框架,如果有一点帮助的话

1 - 您可以在 php 中使用 curl,超时时间很短
2 - 您可以使用 popen 启动批处理或脚本 shell 而无需等待响应:如 pclose(popen("ws_start.sh"));

希望对您有所帮助:)