Page statistics based on the php file operation. if the page statistics only need to be recorded and no other specific data is recorded, there is no need to use a database to record the data, statistical values can be directly stored in text files. Of course, this is not the best way, but it is the simplest way.
Index.html
Statistics Page statisticsClick
Forwarding
Script var btn_click = document. querySelector ('# btn_click'), btn_forward = document. querySelector ('# btn_forward'), hasTouch = 'ontouchstar' in window; tapend = hasTouch? 'Touchend': 'mouseup'; btn_click.addEventListener (tapend, function () {statistics ('click') ;}, false); btn_forward.addEventListener (tapend, function () {statistics ('Forward ') ;}, false); function statistics (action) {var url = 'http: // localhost/statistics/interfaces/statistics. php? Action = '+ action, script = document. createElement ('script'); script. setAttribute ('src', url); document. querySelector ('head '). appendChild (script);} script
Statistics. php
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.