可道云自动登录
开启可道云的guest用户后,访问域名会跳转到登录页面,还需要点以下才能登录 ,以下代码是让guset用户自动登录先备份根目录的index.php,然后修改index.php.的内容未:
<?php
// #################### 新增:根路径登录判断逻辑 ####################
// 1. 仅匹配「根路径」(k.2pxx.com 或 / 或 /index.php),其他路径不执行
$currentUri = $_SERVER['REQUEST_URI'];
$isRootPath = ($currentUri === '/' || $currentUri === '/');
if ($isRootPath) {
// 2. 获取 kodUserID Cookie(管理员=1,guest=2,未登录=空)
$loginUserID = isset($_COOKIE['kodUserID']) ? $_COOKIE['kodUserID'] : '';
// 3. 未登录(无 kodUserID)→ 自动跳 guest 登录
if (empty($loginUserID)) {
$guestLoginUrl = '/index.php?user/index/loginSubmit&name=guest&password=guest&auto=1';
header('Location: ' . $guestLoginUrl);
exit; // 跳转后立即终止,避免重复加载
}
// 已登录(管理员1/guest2)→ 跳过判断,执行原逻辑
}
// #################### 新增逻辑结束 ####################
// #################### 可道云原始代码(未修改) ####################
ob_start();
include(dirname(__FILE__).'/config/config.php');
$app = new Application();
$app->setDefault('user.index.index');
$app->run();
?>可道云用户登录的链接是:
/index.php?user/index/loginSubmit&name=guest&password=guest&auto=1
获取可道云静态文件CDN链接
通过F12+演示站获取,获取到的链接如下https://static.kodcloud.com/kod/static/last/修改可道云配置文件
配置文件路径./config/setting_user.php
打开文件,在文件末尾添加如下内容:
$GLOBALS['config']['settings']['staticPath'] = "https://static.kodcloud.com/kod/static/last/";
页:
[1]