function setting() { $act = isset($_GET['act']) ? $_GET['act'] : 'home'; $err_msg = $notice_msg = $suc_msg = $ip_list_str = ''; switch ($act) { case 'save': if (empty($_POST['detect_port'])) { $err_msg = "探测端口不能为空"; break; } $detect_port = (int) $_POST['detect_port']; if ($detect_port < 0 || $detect_port > 65535) { $err_msg = "探测端口不合法"; break; } $suc_msg = "保存成功"; \Config\Config::$ProviderPort = $detect_port; saveDetectPortToCache(); break; default: $detect_port = \Config\Config::$ProviderPort; } include ST_ROOT . '/Views/header.tpl.php'; include ST_ROOT . '/Views/setting.tpl.php'; include ST_ROOT . '/Views/footer.tpl.php'; }
/** * 创建实例 * * @return \Imp\Mvc\unknown */ public static function getInstance() { if (null === self::$instance) { self::$instance = new Hmvc(); } self::$hmvcPath = Config\Config::get('hmvc_dir'); return self::$instance; }
public static function init() { error_reporting(E_ALL); if (Config\Config::get('WHOOPS_ERROR', FALSE) || Config\Config::get('DEBUG', FALSE)) { $whoops = new \Whoops\Run(); $request = \Biome\Biome::getService('request'); if ($request->acceptHtml()) { $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler()); } else { if (\Whoops\Util\Misc::isCommandLine()) { $whoops->pushHandler(new \Whoops\Handler\PlainTextHandler()); } else { $whoops->pushHandler(new \Whoops\Handler\JsonResponseHandler()); } } $whoops->register(); } }
/** * Configure di instance * * @param array $configuration * @return void */ public function configure(array $configuration) { $this->_config->extend($configuration); }
public function __construct($url = null, Config\Config $config = null) { $this->config = $config; $urlString = $url ? $url : $this->getCurrentUrl(); $this->urlString = $urlString; if ($urlString) { $url = parse_url($urlString); $this->scheme = isset($url['scheme']) ? $url['scheme'] : null; $this->host = isset($url['host']) ? $url['host'] : null; $this->port = isset($url['port']) ? $url['port'] : ''; $this->query = isset($url['query']) ? $url['query'] : null; $this->urlPath = isset($url['path']) ? $url['path'] : null; } if ($config == null) { return; } $configKey = $this->getConfigKey(); $defaultConfig = $config->current(); $defaultKey = $config->key(); if (isset($config->{$configKey})) { if ($defaultKey == $configKey) { $this->config = $config->{$configKey}; } else { $this->config = $defaultConfig->merge($config->{$configKey}); } } else { throw new Exception\InvalidArgumentException(sprintf('No config found by key %s', $configKey)); } }
<?php \Config\Config::$ProviderPort = 55858;