是否可以启动一个代码块(也许只是调用一个函数),如果它没有在特定时间内执行则跳过它。
//give this function 10 seconds to execute
$value = mega_function();// could take anything from 1-1000 seconds
//if 10 seconds have passed and the value is still not set, abort it and set $value = false;
最佳答案
没有。你必须要么
使用 curl 或
file_get_contents()
调用外部文件中的函数 - 您可以在那里设置超时如有必要,请跟踪
mega_function()
和return()
中的时间。
mega_function()
有什么作用?
关于php - 我可以为代码块设置时间限制吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5960497/