Do I have to send data to check the PHP connection status?
Source: Internet
Author: User
Is it necessary to send data to detect the PHP connection status? I have an application. after the customer submits the computing, the server starts computing. wait for about 1 minute and return the computing result. the client exits midway through and thus needs to exit computing. Question 1: how can I check the status without sending bytes? for example, the following code checks the connection status of sending bytes: & lt ;? Functionsd help: do I have to send data to check the PHP connection status?
I have an application. after the customer submits the computing, the server starts computing. wait for about 1 minute and return the computing result. the client exits during the process and needs to exit computing.
Question 1: How to check the status without sending bytes? for example, the following code checks the connection status of sending bytes.
Function sd ()
{
If (connection_status ()! = 0)
File_put_contents ("D :\\ AppServ \\ www \\ forward and return .txt ","");
}
Register_shutdown_function ("sd ");
For ($ I = 0; $ I <10; $ I ++)
{
Echo "1 ";
Flush ();
Sleep (1 );
}
Echo "END ";
?>
This code triggers the creation of a txt file when the client closes the request, but I want to remove echo "1" or send a 0-byte message. I have tried multiple methods.
Question 2: How do proc_open programs force kill in the shutdown callback?
------ Solution --------------------
1. php only checks the connection status during output. You can output only spaces
2. if no preset communication interface is used, it is impossible to do so.
------ Solution --------------------
Proc_get_status can I kill the process id after obtaining it?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.