File tree Expand file tree Collapse file tree 1 file changed +32
-6
lines changed
reference/pcntl/functions Expand file tree Collapse file tree 1 file changed +32
-6
lines changed Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
2
<!-- $Revision$ -->
3
- <!-- EN-Revision: b608b323883ac77489a31f8a1aa406e17c202bcb Maintainer: takagi Status: ready -->
3
+ <!-- EN-Revision: 4ac5624be0dc8484a333514b605150e73cad06b8 Maintainer: takagi Status: ready -->
4
4
5
5
<refentry xml : id =" function.pcntl-get-last-error" xmlns =" http://docbook.org/ns/docbook" xmlns : xlink =" http://www.w3.org/1999/xlink" >
6
6
<refnamediv >
15
15
<void />
16
16
</methodsynopsis >
17
17
<para >
18
-
18
+ 直前に失敗した pcntl 関数によって設定されたエラー番号 (<literal >errno</literal >) を取得します。
19
+ エラー番号に関連付けられたシステムエラーメッセージは、 <function >pcntl_strerror</function > を使用して確認できます。
19
20
</para >
20
-
21
- &warn.undocumented.func;
22
-
23
21
</refsect1 >
24
22
25
23
<refsect1 role =" parameters" >
30
28
<refsect1 role =" returnvalues" >
31
29
&reftitle.returnvalues;
32
30
<para >
33
- エラーコードを返します 。
31
+ 直前に失敗した pcntl 関数によって設定されたエラー番号 (< literal >errno</ literal >) を返します。エラーが発生していない場合は、 0 を返します 。
34
32
</para >
35
33
</refsect1 >
36
34
35
+ <refsect1 role =" examples" >
36
+ &reftitle.examples;
37
+ <example >
38
+ <title ><function >pcntl_get_last_error</function > の例</title >
39
+ <para >
40
+ この例では、存在しない子プロセスを待機しようと試みた後、対応するエラーメッセージを出力します。
41
+ </para >
42
+ <programlisting role =" php" >
43
+ <![CDATA[
44
+ <?php
45
+ $pid = pcntl_wait($status);
46
+ if ($pid === -1) {
47
+ $errno = pcntl_get_last_error();
48
+ $message = pcntl_strerror($errno);
49
+ fwrite(STDERR, 'pcntl_wait がエラー番号' . $errno
50
+ . 'で失敗しました: ' . $message . PHP_EOL);
51
+ }
52
+ ]]>
53
+ </programlisting >
54
+ &example.outputs.similar;
55
+ <screen >
56
+ <![CDATA[
57
+ pcntl_wait がエラー番号 10 で失敗しました: 子プロセスが存在しません
58
+ ]]>
59
+ </screen >
60
+ </example >
61
+ </refsect1 >
62
+
37
63
<refsect1 role =" seealso" >
38
64
&reftitle.seealso;
39
65
<simplelist >
You can’t perform that action at this time.
0 commit comments