Linux-计算PV UV 独立ip 可刷新运行 刷新

代码:

$cmd = "grep 'GET /blog/post/click-task-system' /var/log/nginx/www.jc91715.top.access.log -c";
$ret = shell_exec($cmd);

echo "PV\n";
echo $ret;

$cmd = "grep 'blog/post/click-task-system' /var/log/nginx/www.jc91715.top.access.log | cut -d ' ' -f 1  | sort | uniq| wc -l";
$ret = shell_exec($cmd);

echo "UV\n";
echo $ret;

$cmd = "cat /var/log/nginx/www.jc91715.top.access.log | cut -d ' ' -f 1  | sort | uniq|wc -l";
$ret = shell_exec($cmd);

echo "独立ip\n";
echo $ret;

输出:

PV
14
UV
10
独立ip
1234