PHP - Count downloads

后端 未结 2 1622
误落风尘
误落风尘 2020-12-17 04:33

I\'ld like to count file downloads with PHP. The downloads number should be stored in a .TXT file.

How that can be done? Thanks Uli

2条回答
  •  旧巷少年郎
    2020-12-17 05:25

    $current_count = file_get_contents('count');
    $f = fopen('count', 'w+');
    fwrite($f, $current_count + 1);
    fclose($f);
    
    header("Location: file.zip");
    

提交回复
热议问题