如何让脚本在后台运行[关闭]

I have seen some websites that let you submit a file, then they say "Please check back in 20 minutes and your file will be processed". So the user sends a request to the server, then the server processes it in the background.

How is this done? Specifically, how is this done in PHP?

It can be done by calling a service working independently. For example you can do something like this:

  • send a request to the service to start processing something (service return an ID of started process)
  • after some time you ask service again about process status (you need to send an ID of the process)
  • if service still working then you get an information about it
  • if service has finish then you can get a result from it