问题
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 )
回答1:
Create an sql table with two columns:
- Full path to file (primary key)
- Counter
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.
回答2:
You can make a download script, which is very bad for performance. My solution would be just periodical apache access log parsing.
回答3:
http://tutorialzine.com/2010/02/php-mysql-download-counter/
(2nd on google search results with keywords: php mysql create download counter)
来源:https://stackoverflow.com/questions/2997482/how-to-create-file-download-counter