时间:2021-07-01 10:21:17 帮助过:12人阅读
第一步:
在网站根目录创建一个文件夹,以后就要通过这个文件夹进入后台登录界面的,所以文件夹名就要取一个不易被人轻易猜到的名称。这里作为演示,我就取为 adminweb 好了。接着,在这个文件夹里新建一个文件index.php,内容为:
- <!--?php <span-->define('PHPCMS_PATH', <span>realpath</span>(<span>dirname</span>(<span>__FILE__</span>) . '/..') . '/'<span>);
- </span><span>include</span> PHPCMS_PATH . '/phpcms/base.php'; <span>//</span><span> pc_base::creat_app();</span><span>$session_storage</span> = 'session_' . pc_base :: load_config('system', 'session_storage'<span>);
- pc_base </span>:: load_sys_class(<span>$session_storage</span><span>);
- </span><span>session_start</span><span>();
- </span><span>$_SESSION</span>['right_enter'] = 1<span>;
- </span><span>unset</span>(<span>$session_storage</span><span>);
- </span><span>header</span>('location:../index.php?m=admin');
第二步:
在 phpcms/modules/admin/ 文件夹里新建一个文件 MY_index.php,内容为:
- <!--?php <span-->defined('IN_PHPCMS') or <span>exit</span>('No permission resources.'<span>);
- </span><span>class</span> MY_index <span>extends</span><span> index {
- </span><span>public</span><span>function</span><span> __construct() {
- </span><span>if</span> (<span>empty</span>(<span>$_SESSION</span>['right_enter'<span>])) {
- </span><span>header</span>('location:./'<span>);
- </span><span>exit</span><span>;
- }
- parent </span>::<span> __construct();
- }
- </span><span>public</span><span>function</span><span> public_logout() {
- </span><span>$_SESSION</span>['right_enter'] = 0<span>;
- parent </span>::<span> public_logout();
- }
- }</span>
以上就介绍了PHPCMS 修改后台路径简便方法,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。