/home/wwwRoot/djcscs.com/XCODA/libraries/redisCache.class.php
*/
public function hGet($key, $field)
{
return $this->redis->hGet($key, $field);
}
/**
* 为hash表设定一个字段的值
*
* @param string $key
* 缓存key
* @param string $field
* 字段
* @param string $value
* 值。
* @return bool
*/
public function hSet($key, $field, $value)
{
return $this->redis->hSet($key, $field, $value);
}
/**
* 判断hash表中,指定field是不是存在
*
* @param string $key
* 缓存key
* @param string $field
* 字段
* @return bool
*/
public function hExists($key, $field)
{
return $this->redis->hExists($key, $field);
}
/**
* 删除hash表中指定字段 ,支持批量删除
*
* @param string $key
Arguments
"MISCONF Redis is configured to save RDB snapshots, but it's currently unable to persist to disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error."
/home/wwwRoot/djcscs.com/XCODA/libraries/redisCache.class.php
*/
public function hGet($key, $field)
{
return $this->redis->hGet($key, $field);
}
/**
* 为hash表设定一个字段的值
*
* @param string $key
* 缓存key
* @param string $field
* 字段
* @param string $value
* 值。
* @return bool
*/
public function hSet($key, $field, $value)
{
return $this->redis->hSet($key, $field, $value);
}
/**
* 判断hash表中,指定field是不是存在
*
* @param string $key
* 缓存key
* @param string $field
* 字段
* @return bool
*/
public function hExists($key, $field)
{
return $this->redis->hExists($key, $field);
}
/**
* 删除hash表中指定字段 ,支持批量删除
*
* @param string $key
/home/wwwRoot/djcscs.com/XCODA/core/model.class.php
$data = [];
$key = md5(PRODUCT . $sql);
$domain = NetUtil::getRootDomainByHost();
$openRedis = Config::get('openRedis');
$openRedis = empty($openRedis) ? 0 : $openRedis;
$useCache = USEMC;
if ($useCache) {
if ($openRedis) {
$config = array(
'host' => '127.0.0.1',
'port' => '6379',
'auth' => ''
);
$redisCacheObj = redisCache::getInstance($config, []);
$data = json_decode($redisCacheObj->hget($domain, $key), true);
if ($data) {
return $data;
} else {
$data = $this->query($sql);
$redisCacheObj->hset($domain, $key, json_encode($data));
if ($cacheTime > 0) {
$redisCacheObj->expire($domain, $cacheTime);
}
return $data;
}
} else {
$fileDir = ROOT_PATH . "/data/" . $dir . "/";
$file = ROOT_PATH . "/data/" . $dir . "/" . md5($sql) . '.db.php';
if (!file_exists($fileDir)) {
FileUtil::createDir($fileDir);
}
if ($cacheTime) {
if (is_file($file) && time() - filemtime($file) < $cacheTime) {
return unserialize(file_get_contents($file));
} else {
$data = $this->query($sql);
file_put_contents($file, serialize($data), LOCK_EX);
return $data;
}
}
/home/wwwRoot/djcscs.com/XCODA/core/controller.class.php
public function initialize()
{
$urlObj = new Url();
$msgObj = new Msg();
$configObj = new Config();
$modelObj = M("system_model");
$this->tpl->assign("msgObj", $msgObj);
$this->tpl->assign("urlObj", $urlObj);
$this->tpl->assign("configObj", $configObj);
$this->tpl->assign("model", $modelObj);
//系统执行时间和占用内存
$showPower = Config::get("showPower");
if ($showPower) {
$this->tpl->assign("getRunTime", DateUtil::getRunTime());
$this->tpl->assign("getMemory", DateUtil::getRunM());
}
$tableIsExist = $modelObj->tableIsExist('se_plugin_global_languages');
if ($tableIsExist) {
$langAry = $modelObj->execute("SELECT lang_name,lang_code,lang_locale,lang_flag FROM se_plugin_global_languages order by lang_order asc", 86400 * 30);
$this->tpl->assign("langAry", $langAry);
}
}
public function Run()
{
$a = SecurityFilter::G('a');
$c = SecurityFilter::G('c');
$ac = SecurityFilter::G('ac');
/**兼容旧版开始**/
$cStr = empty($c) ? 'index' : $c;
$aStr = empty($a) ? 'defaultAction' : $a;
$this->control = empty($this->control) ? $cStr : $this->control;
$this->action = empty($this->action) ? $aStr : $this->action;
if (!empty($ac)) {
$acAry = explode("_", $ac);
if (count($acAry) == 2) {
$action = $acAry[1];
$control = $acAry[0];
}
/home/wwwRoot/djcscs.com/XCODA/core/controller.class.php
* Q Q: 9877633
* -------------------------------------------------------
*
* @author : milkcy <milkcy@foxmail.com>
* @version : v1.0
* =======================================================
*/
class controller
{
public $tpl;
public $control;
public $action;
public function __construct()
{
$this->tpl = Smarty::getInstance();
$this->initialize();
}
public function __call($func, $arg)
{
$this->tpl->assign("eTitle", 'PHP框架错误');
$this->tpl->assign("eContent", $func . Config::lang("METHODNOTFIND"));
$this->tpl->display("file:[2]error.html");
exit();
}
public function setValue($var, $value)
{
$this->tpl->assign($var, $value);
}
public function forward($file, $cacheId = '', $cacheTime = 3600)
{
$k = 0; //0默认主模板目录 1 插件目录 2系统模板目录
if (!$this->tpl->templateExists($file)) {
$k = 2;
/home/wwwRoot/djcscs.com/index.php
'www.djcscs.com' => true, // 允许访问网页
'local.djcscs.com' => true, // 允许访问网页
'm.djcscs.com' => true, // 允许访问网页
'play.djcscs.com' => false, // 不允许访问 index.php(仅用于下载附件)
'api.dangdj.com' => false, // 不允许访问 index.php(仅用于访问 api.php)
];
$m = empty($_GET['m']) ? '' : $_GET['m'];
$ac = empty($_GET['ac']) ? '' : $_GET['ac'];
if ($m != 'plugin' && $ac != 'news_show' && (!isset($allowedDomains[$currentDomain]) || $allowedDomains[$currentDomain] !== true)) {
//exit('Access Denied: This domain is not allowed to access the homepage.');
}
//实例化controller
$m = 'Run';
$dir = Config::get('pluginIndex');
if (!empty($_GET['m']) || !empty($dir)) {
$m = 'plugin';
}
$control = new Controller();
$control->$m();