function.set-time-limit.html
来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 116 行
HTML
116 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Limits the maximum execution time</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.set-magic-quotes-runtime.html">set_magic_quotes_runtime</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.sys-get-temp-dir.html">sys_get_temp_dir</a></div> <div class="up"><a href="ref.info.html">PHP Options/Info Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.set-time-limit" class="refentry"> <div class="refnamediv"> <h1 class="refname">set_time_limit</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">set_time_limit</span> — <span class="dc-title">Limits the maximum execution time</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><span class="type void">void</span></span> <span class="methodname"><b><b>set_time_limit</b></b></span> ( <span class="methodparam"><span class="type">int</span> <tt class="parameter">$seconds</tt></span> )</div> <p class="para rdfs-comment"> Set the number of seconds a script is allowed to run. If this is reached, the script returns a fatal error. The default limit is 30 seconds or, if it exists, the <i>max_execution_time</i> value defined in the <var class="filename">php.ini</var>. </p> <p class="para"> When called, <b>set_time_limit()</b> restarts the timeout counter from zero. In other words, if the timeout is the default 30 seconds, and 25 seconds into script execution a call such as <i>set_time_limit(20)</i> is made, the script will run for a total of 45 seconds before timing out. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">seconds</tt></i></span> <dd> <p class="para"> The maximum execution time, in seconds. If set to zero, no time limit is imposed. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> No value is returned. </p> </div> <div class="refsect1 notes"> <h3 class="title">Notes</h3> <div class="warning"><b class="warning">Warning</b> <p class="para"> This function has no effect when PHP is running in <a href="features.safe-mode.html#ini.safe-mode" class="link">safe mode</a>. There is no workaround other than turning off safe mode or changing the time limit in the <var class="filename">php.ini</var>. </p> </div> <blockquote><p><b class="note">Note</b>: The <b>set_time_limit()</b> function and the configuration directive <a href="info.configuration.html#ini.max-execution-time" class="link">max_execution_time</a> only affect the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using <a href="function.system.html" class="function">system()</a>, stream operations, database queries, etc. is not included when determining the maximum time that the script has been running. <br /> </p></blockquote> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="info.configuration.html#ini.max-execution-time" class="link">max_execution_time</a></li> <li class="member"><a href="info.configuration.html#ini.max-input-time" class="link">max_input_time</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.set-magic-quotes-runtime.html">set_magic_quotes_runtime</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.sys-get-temp-dir.html">sys_get_temp_dir</a></div> <div class="up"><a href="ref.info.html">PHP Options/Info Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?