typecho 评论表单头像
关于评论表单的这个头像,其实挺麻烦的,动不动代码就会报错,超蛋疼的,于是我琢磨了下,想了个思路。
- 用户未登录使用固定头像
- 用户登录了使用登录头像
- 用户是访客,已经留言了,使用留言的邮箱获取头像
众所周知,typecho的头像是使用全球头像Gravatar的,Gravatar他本身也是通过邮箱来设置账户的,所以我们通过邮箱也能获取到头像地址。
不多说,上代码
此处内容已隐藏回复后方可阅读。
其中
images/comment/akari.jpg
这个是主题目录里面固定头像的路径,自己根据自己的主题设置即可,其他的直接用。效果还不错,因为typecho会把已留言的游客邮箱和用户名保存在cookie里面,我们就可以利用php自动去读取这个邮箱,再里面md5签名算法,得到Gravatar的头像地址段。
分类:
Typecho博客教程
标签:
typecho教程评论头像
版权申明
本文系作者 @木灵鱼儿 原创发布在木灵鱼儿站点。未经许可,禁止转载。
最新文章
Nestjs CORS配置和生产环境处理
1点赞
·
0评论
Debian12 SSH连接报错:Error Handshake failed no matching host key format
0点赞
·
0评论
Prisma 使用MongoDB创建数据时报错:Prisma needs to perform transactions, which requires your MongoDB server to be run as a replica set.
0点赞
·
0评论
Prisma 初始化MongoDB数据库下载报错reason unable to verify the first certificate解决方案
0点赞
·
0评论
Nuxt3 useFetch和$fetch的探讨以及封装请求处理
0点赞
·
3评论
目录
暂无目录
全部评论 50
东南坤
Safari MacOS小何同志
Google Chrome Windows 102B铅笔
Google Chrome Windows 10华子
Google Chrome Windows 10猫的报恩
Google Chrome Windows 7木灵鱼儿
FireFox Windows 10猫的报恩
Google Chrome Windows 7木灵鱼儿
FireFox Windows 10猫的报恩
Google Chrome Windows 7RRR
FireFox Windows 10gcq
Google Chrome Androidfay
Google Chrome Windows 10Kanyikan
Google Chrome Windows 10kingkare
Google Chrome Windows 7