The scenario is as follows: An external service posts a request to me and waits for my return value, I get its post request and
immediately return to it to receive a successful message,
wait for a specified number of seconds before performing the following operation.
Sleep is used in the code as follows
Ob_start ();
Echo Receives success information
Ob_flush ();
Flush ();
Sleep (XXX);
Do_next ();
The result is that the external service cannot immediately get the received information and must wait for sleep to complete before receiving it.
Can you tell me how this demand for Daniel?
Reply content:
The scenario is as follows: An external service posts a request to me and waits for my return value, I get its post request and immediately return to it to receive a successful message, wait for a specified number of seconds before performing the following operation.
Sleep is used in the code as follows
Ob_start ();
Echo Receives success information
Ob_flush ();
Flush ();
Sleep (XXX);
Do_next ();
The result is that the external service cannot immediately get the received information and must wait for sleep to complete before receiving it.
Can you tell me how this demand for Daniel?
There are more restrictions on the operation of the flush buffer, which can be seen here.
However, it is highly recommended that you use PHP the queuing system for asynchronous operations.