index.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. declare(strict_types=0);
  3. /**
  4. * 商城板块初始化文件
  5. *
  6. *
  7. * * */
  8. define('APP_ID','admin');
  9. define('BASE_ROOT_PATH',str_replace('/admin','',dirname(__FILE__)));
  10. define('BASE_PATH',str_replace('\\','/',dirname(__FILE__)));
  11. function handle_error($level, $message, $file, $line)
  12. {
  13. if($level == E_NOTICE) return;
  14. $trace = "handle_error: level={$level},msg={$message} file={$file},line={$line}\n";
  15. $backtrace = debug_backtrace();
  16. foreach ($backtrace as $item) {
  17. $trace .= "{$item['file']}\t{$item['line']}\t{$item['function']}\n";
  18. }
  19. Log::record($trace,Log::DEBUG);
  20. }
  21. set_error_handler('handle_error');
  22. if (!@include(dirname(dirname(__FILE__)).'/global.php')) exit('global.php isn\'t exists!');
  23. if (!@include(BASE_CORE_PATH.'/lrlz.php')) exit('lrlz.php isn\'t exists!');
  24. define('TPL_NAME',TPL_ADMIN_NAME);
  25. define('ADMIN_TEMPLATES_URL',ADMIN_SITE_URL.'/templates/'.TPL_NAME);
  26. define('BASE_TPL_PATH',BASE_PATH.'/templates/'.TPL_NAME);
  27. if (!@include(BASE_PATH.'/control/control.php')) exit('control.php isn\'t exists!');
  28. include(BASE_CONFIG_PATH . CONFIG_PREFIX . '/refill.ini.php');
  29. $start = microtime(true);
  30. $addr = $_SERVER['REMOTE_ADDR'];
  31. Log::record("admin start request ip:$addr", Log::DEBUG);
  32. Base::run();
  33. $msg = sprintf("admin request time=%.6f\r\n\r\n",microtime(true) - $start);
  34. Log::record($msg,Log::DEBUG);