我有一个聊天机器人,它将一些数据保存到用户发送的数据库中。在向用户发送响应后,我想将其保存到 db(一个缓慢的网络调用)。
我可以在 Python Tornado 中做到这一点,但我无法做到 PHP Apache。
用户将输入作为请求发送->我们处理它->我们将输出作为响应发送给用户->然后我们希望存储数据
  class A
  {
      function __construct()
        {
          echo "Hello World";
        }
      function __destruct()
        {
          sleep(15); //I want this to happen after response is being send
        }
      function calc()
        {
          echo "Progress World";
        }
  }