PHP Asynchronous e-mail issue
Demand:
In a system, upload a product patch file or release product update information, need to use the product users (more users) send an e-mail, sent after the prompt sent!
Our common PHP code is written as follows:
Let's say 100 messages are sent this time. What will happen to this operation?
User experience: User wait-and-send message completion--return information (this period is very likely, script execution timed out)
This operation due to the need to send a large number of messages, resulting in PHP execution time is too long, the user impatient waiting. When Apache or Nginx waits beyond the allowed execution time, a timeout error is returned. This time the user is not clear whether this operation is successful or not, in the end sent a few emails.
From this we can see that the above code user experience is very poor, and can not successfully complete the task.
So how to solve the problem of poor user experience?
A concept is mentioned here that executes asynchronously
User experience: User waits, Send complete
Friends will ask, how to lack the sending link?
OK, send a link in the user submits the request, the letter to the task to a separate processing of the PHP program processing, when the user saw "send complete" when the fact that the message has not been sent, this time, the sending process is working in the background, a lunar sealed outward sent.
Articles you may be interested in
- How to solve the problem of concurrent read and write file conflicts in PHP
- PHP Send mail component
- Compress website js and CSS files using PHP's gzip compression to speed up website access
- How to optimize server, static, database optimization, load balancing to achieve high load for large traffic website
- JavaScript solves the problem of left and right height adaptive
- PHP addresses URL encoding problem functions UrlEncode (), UrlDecode (), Rawurlencode (), Rawurldecode ()
- Use PHP function memory_get_usage to get the current PHP memory consumption to achieve program performance optimization
- Send mail SMTP Error Could not connect to SMTP host. Solution for Send fail
http://www.bkjia.com/PHPjc/901423.html www.bkjia.com true http://www.bkjia.com/PHPjc/901423.html techarticle PHP Asynchronous e-mail problem requirements: In a system, upload a product patch file or release product update information, need to use the product users (more ...