Wlcome.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace app\home\controller;
  3. use think\Lang;
  4. use think\Cache;
  5. class Wlcome extends AdminControl
  6. {
  7. public function _initialize()
  8. {
  9. parent::_initialize();
  10. Lang::load(APP_PATH . 'home/lang/' . config('default_lang') . '/index.lang.php');
  11. }
  12. /**
  13. * 首页
  14. * @return mixed
  15. */
  16. public function index()
  17. {
  18. $setup_date = config('setup_date');
  19. $statistics['os'] = PHP_OS;
  20. $statistics['web_server'] = $_SERVER['SERVER_SOFTWARE'];
  21. $statistics['php_version'] = PHP_VERSION;
  22. $statistics['sql_version'] = $this->_mysql_version();
  23. $statistics['setup_date'] = substr($setup_date, 0, 10);
  24. $statistics['domain'] = $_SERVER['HTTP_HOST'];
  25. $statistics['ip'] = GetHostByName($_SERVER['SERVER_NAME']);
  26. $statistics['zlib'] = function_exists('gzclose') ? 'YES' : 'NO'; //zlib
  27. $statistics['safe_mode'] = (boolean)ini_get('safe_mode') ? 'YES' : 'NO'; //safe_mode = Off
  28. $statistics['timezone'] = function_exists("date_default_timezone_get") ? date_default_timezone_get() : "no_timezone";
  29. $statistics['curl'] = function_exists('curl_init') ? 'YES' : 'NO';
  30. $statistics['fileupload'] = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'unknown';
  31. $statistics['max_ex_time'] = @ini_get("max_execution_time") . 's'; //脚本最大执行时间
  32. $statistics['set_time_limit'] = function_exists("set_time_limit") ? true : false;
  33. $statistics['memory_limit'] = ini_get('memory_limit');
  34. $statistics['version'] = file_get_contents(APP_PATH . 'version.php');
  35. if (function_exists("gd_info")) {
  36. $gd = gd_info();
  37. $statistics['gdinfo'] = $gd['GD Version'];
  38. } else {
  39. $statistics['gdinfo'] = lang('Unknown');
  40. }
  41. $this->assign('statistics', $statistics);
  42. return $this->fetch('index');
  43. }
  44. private function _mysql_version()
  45. {
  46. $version = db()->query("select version() as ver");
  47. return $version[0]['ver'];
  48. }
  49. protected function getAdminItemList()
  50. {
  51. $menu_array = array(
  52. array(
  53. 'name' => 'index', 'text' => "欢迎界面", 'url' => url('Wlcome/index')
  54. )
  55. );
  56. return $menu_array;
  57. }
  58. }