如何创建文件下载计数器? [英] How to create file download counter?

查看:88
本文介绍了如何创建文件下载计数器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪种方法最简单(用PHP和SQL创建代码)来计算文件下载量?

Which is the most simple way to create code ( with PHP and SQL ) which will count the file downloads ?

我已经在基础专用数据库中有一个整数列为此功能...

I already have an integer column in the base dedicated for this feature...

(也欢迎链接到某些示例)

( link to some example will also be welcomed )

推荐答案

创建一个包含两列的sql表:

Create an sql table with two columns:


  1. 文件的完整路径(主键)

  2. Counter

设置下载链接以转到php脚本。在该脚本中,根据完整路径查找适当的表行,增加其计数,然后将浏览器重定向到文件进行下载。

Setup your links for downloading to go to a php script. In that script, lookup the appropriate table row based on the full path, increment it's count, then redirect the browser to the file for downloading.

这篇关于如何创建文件下载计数器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆