The current repo belongs to Paused status, and some functions are restricted. For details, please refer to the description of repo status
Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
publics.php 595 Bytes
Copy Edit Raw Blame History
zhangziliang authored 2018-02-09 17:32 . swoole
<?php
class publics {
public static function getDB($node){
if(IS_CLI) {
return self::getResObject($node);
}
$res = new resources(\Yaf\Registry::get('config'));
return $res->getDB($node);
}
public static function getRedis($node){
if(IS_CLI) {
$key = 'res_redis_' . $node;
return self::getResObject($key);
}
$res = new resources(\Yaf\Registry::get('config'));
return $res->getRedis($node);
}
private static function getResObject($key){
if(!\Yaf\Registry::has($key)){
throw new \Exception('no Resources Object: '.$key);
}
return \Yaf\Registry::get($key);
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化