©
This document uses PHP Chinese website manual Release
(PECL pthreads >= 2.0.0)
Threaded::getTerminationInfo — Error Detection
返回对象的终端错误信息
此函数没有参数。
包含终端信息的数组对象
Example #1 检测线程运行时的致命错误
<?php
class My extends Thread {
public function run () {
@ not_found ();
}
}
$my = new My ();
$my -> start ();
$my -> join ();
var_dump ( $my -> isTerminated (), $my -> getTerminationInfo ());
?>
以上例程会输出:
bool(true) array(4) { ["scope"]=> string(2) "My" ["function"]=> string(3) "run" ["file"]=> string(29) "/usr/src/pthreads/sandbox.php" ["line"]=> int(4) }