Last active
August 29, 2015 14:15
-
-
Save iGlitch/4c58f9fbf80540dde9fb to your computer and use it in GitHub Desktop.
Simple Counter :: 1335 人目のアクセスです Format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? /*シンプルカウンタ*/ | |
/*count.txtを作成します*/ | |
$fp = @fopen("count.txt","r+") or die("ファイルが開けません"); | |
flock($fp, LOCK_EX); | |
$count = fgets($fp, 64); //64バイトorEOFまで取得、カウントアップ | |
$count++; | |
rewind($fp); //ポインタを先頭に、ロックして書き込み | |
fputs($fp, $count); | |
fclose($fp); //ファイルを閉じる | |
echo $count; //カウンタ表示 | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment