wordpress不用插件如何实现访客统计,方法很简单,下面web建站小编给大家讲解一下步骤!
1、新建一个wp_count表
id ip times
2、建一个count.php文件
<?php
//连接数据库
$conn=mysql_connect("localhost","root","123456");
if(!$conn){
die("链接失败".mysql_errno());
}
//设置数据库编码方式
mysql_query("set names utf8",$conn) or die(mysql_errno());
//选择数据库
mysql_select_db("wordpress",$conn) or die(mysql_errno());
$adress=$_SERVER["REMOTE_ADDR"];
//将本次访客的ip地址添加到数据库中
$sql="select times from wp_count where ip='$adress'";
$res=mysql_query($sql,$conn);
if(!$row=mysql_fetch_row($res)){
$sql="insert into wp_count(ip, times) values('$adress','1')";
}else{
$times = $row['0']+1;
$sql="update wp_count set times='$times' where ip='$adress'";
}
$res=mysql_query($sql,$conn);
//发送语句获取总数
$sql="select count(ip) from wp_count";
$res=mysql_query($sql,$conn);
if($row=mysql_fetch_row($res)){
$num=$row['0'];
}
echo"您是第 "."$num"." 位访客"."您的ip地址是"."$adress";
mysql_close();
?>
上面是“wordpress不用插件如何实现访客统计”的全面内容,想了解更多关于 wordpress 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_2489.html
workflows工作流
乡村枯树黄花comfyui工作流
一个表情深思熟虑的成熟男人
文生图工作流:树枝上站着一只鸟
一个黄色的海绵宝宝ComfyUI工作流
一张超现实主义美女照片ComfyUI工作流
一棵树从鸟笼里长出来的梦幻般场景
骨骼般的恶魔修女ComfyUI工作流
1个很漂亮的单身小女孩ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

js实现table表格动态新增行和列表
用canvas实现画板涂鸦效果
用svg画出游泳池动画效果
纯css3绘制的小鸟
利用css3做一个动态loading效果
利用html5+css3实现滚雪球效果(附代码)
canvas空间文本射线










