typecho 重定向
以前台注册为例,他是一个独立页,所以输入地址是可以直接进入的,但是如果用户已经登录了,按道理,这个页面是不能进的,所以需要重定向。
于是乎我们需要在开头加上这么一句话
if ($this->user->hasLogin()) {
header("Location:".$this->options->siteUrl);
exit;
}
这里以独立页做个演示:
<?php
/**
* register
*
* @package custom
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
if ($this->user->hasLogin()) {
header("Location:".$this->options->siteUrl);
exit;
}
?>
我们在开头的头信息处做这个即可。
分类:
Typecho博客教程
标签:
typecho
版权申明
本文系作者 @木灵鱼儿 原创发布在木灵鱼儿站点。未经许可,禁止转载。
评论
最新文章
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评论
Nuxt3使用pinia并持久化处理,同时配置自动引入自定义的仓库store模块
0点赞
·
0评论
目录
暂无目录
暂无评论数据