app/common.php
(开头部分) 9KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
/**
* 人人站CMS
* ============================================================================
* 版权所有 2015-2030 山东康程信息科技有限公司,并保留所有权利。
* 网站地址: http://www.rrzcms.com
* ----------------------------------------------------------------------------
* 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
* ============================================================================
*/
use think\facade\Cache;
/*
* 获取配置信息
*/
function sysConfig($key = '', $data = null, $def = null, $isUpdate = false) {
$param = array_values(array_filter(explode('.', $key)));
if (!$param) return null;
$key = strtoupper('config_' . $param[0]);//缓存键
if ($data === null) {//取值
$cache = cache($key);//获取缓存数据
if (isset($param[1]) && !$isUpdate) {
if ($cache && isset($cache[$param[1]])) {
return $cache[$param[1]];
}
} elseif ($cache && !$isUpdate) {
return $cache;
}
$where = ['type' => $param[0],];
$rows = think\facade\Db::name('config')->where($where)->field('name,value')->select()->toArray();
$config = $rows ? array_column($rows, 'value', 'name') : [];
$config and cache($key, $config);//设置缓存
if (isset($param[1])) {
return $config[$param[1]] ?? $def;
}
return $config ?: ($def ?: []);
}
//更新
if (!is_array($data) && count($param) > 1) {
$_data[$param[1]] = $data;
$data = $_data;
unset($_data);
}
$config = sysConfig($param[0], null, null, true);
$news = [];
foreach ($data as $k => $v) {
$v = trim((string)$v);
$newArr = ['name' => $k, 'value' => $v, 'type' => $param[0],];
if (!$config || !isset($config[$k])) {
$news[] = $newArr;
$config[$k] = $v;
} elseif ($config[$k] != $v) {
$where = ['name' => $k, 'type' => $newArr['type'],];
think\facade\Db::name('config')->where($where)->save(['value' => $v,]);
$config[$k] = $v;
后面还有 288 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。