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工作流
半透明的玻璃苹果ComfyUI工作流
雪地里一只可爱的小老虎
一个红头发明亮眼睛的漂亮女人
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

jquery鼠标滑过图片边框特效(jquery.focus-follow插件)
SVG路径动画效果
纯css制作卡通头像(随鼠标转头)
日历设置每个月颜色都不一样
HTML5 Canvas 刻度尺
javascript如何利用draggable实现一个拖拽效果
利用CSS3做一个星级评分样式
barcode条形码/qrcode二维码兼容所有浏览器(含ie6/ie7/ie8)











