thinkcmf5与宝塔

thinkcmf5与宝塔
1.安装宝塔:https://www.bt.cn/download/linux.html
2.宝塔手册:https://www.kancloud.cn/chudong/bt2017/424204
3.安装拓展:软件商店->安装拓展->重启服务
4.open_basedir:网站->设置->网站目录->防跨站
5.数据库授权:grant all privileges on *.* to root@'%' identified by "密码";FLUSH PRIVILEGES;
6.iptables -F;systemctl stop firewalld;setenforce 0;
7.thinkcmf手册:https://www.kancloud.cn/thinkcmf/doc5_1/957737
8.api文件夹和app文件夹是并列关系,区分它们是依考nginx配置

    location / {
            index  index.php index.html index.htm;
             #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则
             if (!-e $request_filename)
             {
                #地址作为将参数rewrite到index.php上。
                rewrite ^/(.*)$ /index.php?s=$1;
                #若是子目录则使用下面这句,将subdir改成目录名称即可。
                #rewrite ^/subdir/(.*)$ /subdir/index.php?s=$1;
             }
    }
    
    location /api/ {
        index  index.php index.html index.htm;
         #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则
         if (!-e $request_filename)
         {
            #若是子目录则使用下面这句,将subdir改成目录名称即可。
            rewrite ^/api/(.*)$ /api.php?s=$1;
         }
    }


包含公共HTML:https://www.kancloud.cn/thinkcmf/doc5_1/957843
<include file="blog@blog_nav"/>
	
横向nav标签,与自动标记active
	<ul class="nav nav-tabs">
	            <li><a href="/blog/admin_index/index.html">角色管理</a></li>
	            <li><a href="/blog/admin_index/edit.html">添加角色</a></li>
	        </ul>
	<script>
		$(".nav-tabs > li > a[href='"+window.location.pathname+"']").parent().addClass('active')
	</script>

注:登录后台后,自动跳转至前台解决方案。

找到/application/Admin/Controller/PublicController.class.php

将27-31行去除:

$loginAllowed = session("__LOGIN_BY_CMF_ADMIN_PW__");
if (empty($loginAllowed)) {
//$this->error('非法登录!', cmf_get_root() . '/');
return redirect(cmf_get_root() . "/");
}
 
 
找到37-38
session("__SP_ADMIN_LOGIN_PAGE_SHOWED_SUCCESS__", true);
$result = hook_one('admin_login');
中间加一行

session("__SP_ADMIN_LOGIN_PAGE_SHOWED_SUCCESS__", true);
session("__LOGIN_BY_CMF_ADMIN_PW__", 1); 
$result = hook_one('admin_login');
 
替换后就可以正常登陆了(^-^)V

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值