睡眠时间是否计入执行时间限制? [英] Does sleep time count for execution time limit?

查看:98
本文介绍了睡眠时间是否计入执行时间限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于PHP中的sleep()函数,我有两个问题:

I have two questions concerning the sleep() function in PHP:

  1. 睡眠时间是否会影响我的PHP脚本的最大执行时间限制?有时,PHP显示消息超过30秒的最大执行时间".如果我使用sleep(31)会出现此消息吗?

使用sleep()功能是否存在任何风险?它会消耗很多CPU性能吗?

Are there any risks when using the sleep()function? Does it cost a lot of CPU performance?

推荐答案

您应该尝试一下,只是让脚本休眠超过您的最大执行时间即可.

You should try it, just have a script that sleeps for more than your maximum execution time.

<?php
  sleep(ini_get('max_execution_time') + 10);
?>

扰流器:在Linux下,睡眠时间被忽略,但是在Windows下,它算作执行时间.

这篇关于睡眠时间是否计入执行时间限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆