config.php 562 B

1234567891011121314151617
  1. <?php
  2. define('PATH_ROOT',realpath(dirname(__FILE__)).'/../');
  3. define('PATH_CONFIG',PATH_ROOT.'config.json');
  4. define('PATH_PHP',PATH_ROOT.'php/');
  5. define('PATH_JS',PATH_ROOT.'js/');
  6. define('PATH_CSS',PATH_ROOT.'css/');
  7. define('PATH_DATA',PATH_ROOT.'data/');
  8. $GLOBALS['config'] = json_decode(file_get_contents(PATH_CONFIG),true);
  9. function get($setting){
  10. return $GLOBALS['config'][$setting];
  11. }
  12. function set($setting,$value){
  13. $GLOBALS['config'][$setting] = $value;
  14. file_put_contents(PAT_CONFIG,json_encode($GLOBALS['config']));
  15. return $value;
  16. }
  17. ?>