public static function init() { $file_path = Config::getSettingsDir() . 'config.ini'; $array = array(); $array = parse_ini_file($file_path); if (count($array) < 3) { error_log('config.ini info error, please check it!!!'); return false; } self::$db_host = $array["dbHost"]; self::$db_port = $array["dbPort"]; self::$db_name = $array["dbName"]; self::$db_user = $array["dbUser"]; self::$db_password = $array["dbPwd"]; return true; }
<?php require_once Config::getSettingsDir() . 'AnySDKPlatformConfig.php'; final class PayNoticeService { private $redis_ = null; public function __construct() { } public function error($error_type, $error_code = -1) { header('Content-type: application/json'); echo json_encode(array($error_type => "error,{$error_code}")); exit; } public function response($response) { header('Content-type: application/json'); echo json_encode($response); exit; } public function init() { if (ServerConfig::init() === false) { $this->error("login", -1); } } public function checkAnySDKSever($remote_ip) { if (!in_array($remote_ip, AnySDKPlatformConfig::$allow_ip_list)) { return false;
public function init() { $config_file = Config::getSettingsDir() . 'config.ini'; $ret = parse_ini_file($config_file, true); if ($ret === false) { return false; } // app_secret_key if (isset($ret['app']['secret_key']) === false) { error_log('config /app/secret_key not found'); return false; } $this->app_secret_key = $ret['app']['secret_key']; // db_host if (isset($ret['db']['host']) === false) { error_log('config /db/host not found'); return false; } $this->db_host = $ret['db']['host']; // db_port if (isset($ret['db']['port']) === false) { error_log('config /db/port not found'); return false; } $this->db_port = $ret['db']['port']; // db_name if (isset($ret['db']['name']) === false) { error_log('config /db/name not found'); return false; } $this->db_name = $ret['db']['name']; // db_user if (isset($ret['db']['user']) === false) { error_log('config /db/user not found'); return false; } $this->db_user = $ret['db']['user']; // db_password if (isset($ret['db']['password']) === false) { error_log('config /db/password not found'); return false; } $this->db_password = $ret['db']['password']; // redis_host if (isset($ret['redis']['host']) === false) { error_log('config /redis/host not found'); return false; } $this->redis_host = $ret['redis']['host']; // redis_port if (isset($ret['redis']['port']) === false) { error_log('config /redis/port not found'); return false; } $this->redis_port = $ret['redis']['port']; // redis_db if (isset($ret['redis']['db']) === false) { error_log('config /redis/db not found'); return false; } $this->redis_db = $ret['redis']['db']; // redis_password if (isset($ret['redis']['password']) === false) { error_log('config /redis/password not found'); return false; } $this->redis_password = $ret['redis']['password']; return true; }
<?php require_once Config::getSettingsDir() . 'SlaveServerConfig.php'; final class GiftCodeService { private $dbh_ = null; public function __construct() { } public function error($error_type, $error_code = -1) { header('Content-type: application/json'); echo json_encode(array($error_type => "error,{$error_code}")); exit; } public function response($response) { header('Content-type: application/json'); echo json_encode($response); exit; } public function init() { if (ServerConfig::init() === false) { $this->error("login", -1); } } public function getDBHandler() { if ($this->dbh_ != null) { return $this->dbh_;