search
Homephp教程php手册不一样的访客欢迎画面:利用cookies抓取访客头像

哈哈大家好我终于又憋出来一篇了,一天没见是不是很想我!! 之前在小蝴蝶这里评论过的同志们应该已经看到效果了: 由于实在憋不出来东西写了,所以无聊检查了一下网站记录的cookies,其中有一个大家很熟悉,就是我们常见访客欢迎词要用到的 comment_author ,而另一

哈哈大家好我终于又憋出来一篇了,一天没见是不是很想我!!
之前在小蝴蝶这里评论过的同志们应该已经看到效果了:

没头像的 有头像 还是声声的头像

由于实在憋不出来东西写了,所以无聊检查了一下网站记录的cookies,其中有一个大家很熟悉,就是我们常见访客欢迎词要用到的comment_author,而另一个很少有人用,就是comment_author_email
comment_author_email能用来干嘛内?用来抓头像咯.
好了上代码,以下代码扔到你要欢迎访客的地方:
<?php if($_COOKIE["comment_author_email_" . COOKIEHASH]!="") : $fkimg = $_COOKIE['comment_author_email_'.COOKIEHASH];?>
<?php echo get_avatar($fkimg, 50);?>
<?php endif; ?>

如果要实现小蝴蝶那样仿QQ视频的访客欢迎画面,则把代码改成如下(具体css值需要根据你的主题修改)

<?php if($_COOKIE["comment_author_email_" . COOKIEHASH]!="") : $fkimg = $_COOKIE['comment_author_email_'.COOKIEHASH];?>
<div class="fkimg"><?php echo get_avatar($fkimg, 68);?></div>
<img  src="/static/imghwm/default1.png" data-src="/imgr?src=http%3A%2F%2Fxiaohudie.net%2F%E4%BD%A0%E7%9A%84%E5%A4%B4%E5%83%8F%E5%9B%BE%E7%89%87%E5%9C%B0%E5%9D%80" class="lazy"   style="max-width:90%" alt="不一样的访客欢迎画面:利用cookies抓取访客头像" >
<?php else: ?>
<img  src="/static/imghwm/default1.png" data-src="/imgr?src=http%3A%2F%2Fxiaohudie.net%2F%E4%BD%A0%E7%9A%84%E5%A4%B4%E5%83%8F%E5%9B%BE%E7%89%87%E5%9C%B0%E5%9D%80" class="lazy"   style="max-width:90%" alt="不一样的访客欢迎画面:利用cookies抓取访客头像" >
<?php endif; ?>

然后加上css

.fkimg{ float: left; box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.46); margin: 5px 10px 10px 0; width: 68px; height: 68px;}

好了就这么多,昨天那篇吐草被包子破了百,践行诺言来放福利了..
我家镜子就是脏 怎么地
另外跪求大家还是不要破百了,因为我没有新衣服拍了

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor