解决方法:
1.根目录建立文件夹 admpub,在 admpub 文件夹里新建一个文件 index.php,内容为:
define('PHPCMS_PATH', realpath(dirname(__FILE__) . '/..') . '/');
include PHPCMS_PATH . '/phpcms/base.php'; // pc_base::creat_app();
$session_storage = 'session_' . pc_base :: load_config('system', 'session_storage');
pc_base :: load_sys_class($session_storage);
session_start();
$_SESSION['right_enter'] = 1;
unset($session_storage);
header('location:../index.php?m=admin');
2.然后在phpcms/modules/admin/文件夹里新建一个文件MY_index.php,内容为:
defined('IN_PHPCMS') or exit('No permission resources.');
class MY_index extends index {
public function __construct(){
if(empty($_SESSION['right_enter'])){
header('location:./');
exit;
}
parent :: __construct();
}
public function public_logout(){
$_SESSION['right_enter'] = 0;
parent :: public_logout();
}
}
3.修改完后你只能通过 localhost/phpcms/admpub 访问后台,而用 localhost/phpcms/admin.php 后跳转到前台页面.
<< 向左走,向右走 >>