-
Notifications
You must be signed in to change notification settings - Fork 102
/
set-time-limit.xml
88 lines (81 loc) · 2.92 KB
/
set-time-limit.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: dec1f8445ab2af7fbafef012fb7907ab2cd349b5 Maintainer: HonestQiao Status: ready -->
<!-- Reviewed: no Maintainer: HonestQiao -->
<refentry xml:id="function.set-time-limit" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>set_time_limit</refname>
<refpurpose>设置脚本最大执行时间</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>set_time_limit</methodname>
<methodparam><type>int</type><parameter>seconds</parameter></methodparam>
</methodsynopsis>
<para>
设置允许脚本运行的时间,单位为秒。如果超过了此设置,脚本返回一个致命的错误。默认值为30秒,或者是在&php.ini;的<literal>max_execution_time</literal>被定义的值,如果此值存在。
</para>
<para>
当此函数被调用时,<function>set_time_limit</function>会从零开始重新启动超时计数器。换句话说,如果超时默认是30秒,在脚本运行了25秒时调用 <literal>set_time_limit(20)</literal>,那么,脚本在超时之前可运行总时间为45秒。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>seconds</parameter></term>
<listitem>
<para>
最大的执行时间,单位为秒。如果设置为0(零),没有时间方面的限制。
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
成功时返回 &true;,失败时返回 &false; 。
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
<function>set_time_limit</function>函数和配置指令<link linkend="ini.max-execution-time">max_execution_time</link>只影响脚本本身执行的时间。任何发生在诸如使用<function>system</function>的系统调用,流操作,数据库操作等的脚本执行的最大时间不包括其中,当该脚本已运行。在测量时间是实值的Windows中,情况就不是如此了。
</para>
</note>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="ini.max-execution-time">max_execution_time</link></member>
<member><link linkend="ini.max-input-time">max_input_time</link></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->