/** * 构造方法 * * @param type $application_env 配置变量 * @param type $application_path app路径 * @param type $config_file 配置文件路径 * @param type $library_path 类库路径 */ public function __construct($application_env, $application_path, $config_file, $library_path = '') { $this->application_path = $application_path; $this->setAutoload($library_path); $star_config = new Star_Config($config_file, $application_env); $options = $star_config->loadConfig(); $this->setOptions($options); }
/** * 返回配置项 */ public function loadConfig() { if (empty(self::$options)) { $options = $this->config->parseConfig(); self::$options = (array) $options; } return self::$options; }
public static function getCsrfToken() { $token = Star_Config::get('resources.token'); $ip = Star_Http_Request::getIp(); $user_agent = Star_Http_Request::getHttpAgent(); $temp_array = array($token, $ip, $user_agent); sort($temp_array, SORT_STRING); return md5(implode('', $temp_array)); }
/** * 返回server_name * * @return type */ public function getServerName() { if (empty($this->server_name)) { $this->server_name = Star_Config::get('resources.api.server_name'); } return $this->server_name; }