时间:2021-07-01 10:21:17 帮助过:4人阅读
//写进日志
function write_logs($str='') {
global $num;
if($num>1){
$num="ok";
}
$fliepath_dir="test.txt";
$str=$str."-".$num."\r\n";
if($fp = @fopen($fliepath_dir, 'a')) {
@flock($fp, 2);
fwrite($fp, $str);
fclose($fp);
return true;
}else{
return false;
}
}
$num=0;
$act=$_GET["act"];
if($act=="b"){
$num="2";
for ($index = 1; $index < 10; $index++) {
write_logs($index);
sleep(3);
}
}else{
$num=0;
echo "no".$num;
}