只有一行代码的计数器

echo sprintf(($a=@file_get_contents('./counter.txt')+1), file_put_contents('./counter.txt', $a));

echo preg_replace('#(\d+)#e', "$1+!file_put_contents('/tmp/counter.txt','$1')", @file_get_contents('/tmp/counter.txt')+1)
事实证明,结尾可以不要分号

($a=@file_get_contents('/tmp/counter.txt')+1) | file_put_contents('/tmp/counter.txt',$a) | print($a);

posted @ 2008-12-19 09:46  Bateau.zhou  阅读(101)  评论(0)    收藏  举报