$counter = intval(file_get_contents("counter.txt")) + 1;
$fp = fopen("counter.txt", "w");
fwrite($fp, $counter);
fclose($fp);
$fp = fopen("counter.txt", "w");
fwrite($fp, $counter);
fclose($fp);
function MyCounter() {
$counterFile="/tmp".$GLOBALS["PHP_SELF"];
if (!file_exists($counterFile)) {
if (!file_exists(dirname($counterFile))) {
mkdir(dirname($counterFile), 0700);
}
exec("echo 0 > $counterFile");
}
$fp = fopen($counterFile,"rw");
$num = fgets($fp,5);
$num += 1;
print "$num";
echo $counterFile;
exec("rm -rf $counterFile");
exec("echo $num > $counterFile");
}
?>
php里通常都是自己去分析日志文件……----------------------------------------------------------PHP不至于这么落后吧