| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace PhpLife\Config\Sphinx;
- use PhpLife\Frame\Config;
- /**
- * Sphinx配置
- */
- class Core extends Config
- {
- protected static $dataFile = 'sphinx/core.json';
- protected static $data = array();
- /**
- * 获取配置信息,
- * 如果配置了$dataFile则读取后者中的数据
- * @param null $section
- * @param bool $is_pre
- * @return array|null|string
- */
- public static function getData($section = null, $is_pre = FALSE)
- {
- $class = get_called_class();
- $path = self::getPathByMode($class::$dataFile, $is_pre);
- $data = self::readFile($path);
- if (! is_null($section)) {
- if (isset($data[$section])) {
- return $data[$section];
- } else {
- return null;
- }
- }
- return $data;
- }
- }
|