21,886
社区成员
发帖
与我相关
我的任务
分享
error_reporting(E_ALL);
set_time_limit(rand(1,3));
$tt = new TT(10);
$tt->TODO();
class TT
{
private $length = 0;
function __construct($length = 0)
{
$this->length = $length;
register_shutdown_function(array(&$this, 'doSomething'));
}
function TODO()
{
while($this->length--)
{
sleep(1);
}
}
function doSomething()
{
echo $this->length;
file_put_contents("justTest.txt", $this->length);
}
}
register_shutdown_function(array(&$this, 'doSomething'));
register_shutdown_function(array($this, 'doSomething'));