How does PHP limit the execution time of a function?
Source: Internet
Author: User
How does PHP limit the execution time of a function???
For example, you customize a function that runs from 1 seconds to 60 seconds. Now it's time to use the function, but there is a problem that the duration cannot be greater than 30 seconds, and if it is greater than the program error,
There is now no way to limit the elapsed time of the original function without modifying the original function, as long as the function is run for more than 30 seconds, regardless of whether it succeeds or not, returns a result.
------Solution--------------------
Looks like, no, can use, try
1.set_time_limit
2.fsockopen
3.curl
------Solution--------------------
"Without modifying the original function, ... Returns a result whether or not it succeeds. "
I think it is impossible, of course, unless you modify the internal implementation of PHP ...
------Solution--------------------
Personally feel unlikely. Even if you define a time jump, the function should be executed again.
------Solution--------------------
PHP from top to bottom at the beginning of the function to record a time function to record a time, should be able to know the time of the function execution
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.