How to count phpcms?
PHPCMS adds the whole site access statistics function
The current PHPCMS V9 version does not have the whole site access statistics function, but I don’t want to use a third-party plug-in. manage? Here is a tutorial on the website-wide page access statistics function implemented by PHPCMS.
The first step is to customize the function code of access statistics
1. Open the extension.func.php file
File path: phpcms/libs/functions/extention.func .php
2. Type the following code in extension.func.php
function getNewsContent($id){ session_start(); $log = 'log.txt'; if(!$handle = fopen($log,"a+")){ echo '日志文件打开失败'; exit(); } if(!fwrite($handle,session_id().chr(13))){ echo '数据写入失败'; exit(); } fclose($handle); $file = file_get_contents($log); $content = explode(chr(13),$file); echo "访问统计:".(count($content)-1).""; }
The second step is to use the tag in the html template to call it
If I need to add access statistics at the bottom of the website:
Open the file path: phpcms/templates/default/content/footer.html
Add in footer.html {getNewsContent($r['id'])}
can achieve the effect of access statistics.
PHP Chinese website, a large number of free PHPCMS tutorials, welcome to learn online!
The above is the detailed content of How to add statistical functions to phpcms. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
