pbootcms网站之后会员登陆后才能查看网页,以下是模板里的head文件
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{pboot:pagetitle}</title>
<meta name="keywords" content="{pboot:pagekeywords}">
<meta name="description" content="{pboot:pagedescription}">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,shrink-to-fit=no">
<link rel="stylesheet" href="{pboot:sitetplpath}/bootstrap/css/bootstrap.min.css" >
<link rel="stylesheet" href="{pboot:sitetplpath}/font-awesome-4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="{pboot:sitetplpath}/css/aoyun.css?v=v1.3.5" >
<link rel="stylesheet" href="{pboot:sitetplpath}/swiper-4.3.5/css/swiper.min.css">
<link rel="stylesheet" href="{pboot:sitetplpath}/css/animate.css">
<link rel="stylesheet" href="{pboot:sitetplpath}/css/custom.css">
<link rel="shortcut icon" href="{pboot:sitepath}/favicon.ico" type="image/x-icon">
<script src="{pboot:sitetplpath}/js/jquery-1.12.4.min.js" ></script>
<script>
var currentUrl = window.location.href;
var loginPageUrl = "{pboot:sitepath}/?member/login/";
var returnPage = "{pboot:sitepath}/";
if ({pboot:islogin} != 1 && currentUrl.indexOf(loginPageUrl) === -1) {
window.location.replace(loginPageUrl);
}
</script>
</head>
<body>
<!-- 顶部导航菜单 -->
<nav>
<div>
<ul>
<li>
<a href="./" class="nav-link {pboot:if(0=='{sort:scode}')}active{/pboot:if}" data-target="home">首页</a>
</li>
{pboot:nav num=10 parent=0}
<li>
<a href="[nav:link]" class="nav-link {pboot:if('[nav:scode]'=='{sort:tcode}')}active{/pboot:if}" data-target="dashboard">[nav:name]</a>
</li>
{/pboot:nav}
{pboot:if({pboot:islogin}==1)}
<li>
<a href="{pboot:logout}" data-target="settings">退出</a>
</li>
{/pboot:if}
</ul>
</div>
</nav>我们可以看出只需增加一段js判断
<script>
var currentUrl = window.location.href;
var loginPageUrl = "{pboot:sitepath}/?member/login/";
var returnPage = "{pboot:sitepath}/";
if ({pboot:islogin} != 1 && currentUrl.indexOf(loginPageUrl) === -1) {
window.location.replace(loginPageUrl);
}
</script>这样就能实现网站需要用户登陆后才能访问