설명 없음
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Main.php 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Yzncms [ 御宅男工作室 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2018 http://yzncms.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 御宅男 <530765310@qq.com>
  10. // +----------------------------------------------------------------------
  11. // +----------------------------------------------------------------------
  12. // | 后台欢迎页
  13. // +----------------------------------------------------------------------
  14. namespace app\admin\controller;
  15. use app\common\controller\Adminbase;
  16. use think\Db;
  17. class Main extends Adminbase
  18. {
  19. protected $noNeedRight = ['index'];
  20. //欢迎首页
  21. public function index()
  22. {
  23. if (IS_ROOT && $this->auth->password == encrypt_password('admin', $this->auth->encrypt)) {
  24. $this->assign('default_pass', 1);
  25. }
  26. $this->assign('sys_info', $this->get_sys_info());
  27. return $this->fetch();
  28. }
  29. //phpinfo信息 按需显示在前台
  30. protected function get_sys_info()
  31. {
  32. //$sys_info['os'] = PHP_OS; //操作系统
  33. $sys_info['ip'] = GetHostByName($_SERVER['SERVER_NAME']); //服务器IP
  34. $sys_info['web_server'] = $_SERVER['SERVER_SOFTWARE']; //服务器环境
  35. $sys_info['phpv'] = phpversion(); //php版本
  36. $sys_info['fileupload'] = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'unknown'; //文件上传限制
  37. $sys_info['memory_limit'] = ini_get('memory_limit'); //最大占用内存
  38. //$sys_info['set_time_limit'] = function_exists("set_time_limit") ? true : false; //最大执行时间
  39. //$sys_info['zlib'] = function_exists('gzclose') ? 'YES' : 'NO'; //Zlib支持
  40. //$sys_info['safe_mode'] = (boolean) ini_get('safe_mode') ? 'YES' : 'NO'; //安全模式
  41. //$sys_info['timezone'] = function_exists("date_default_timezone_get") ? date_default_timezone_get() : "no_timezone";
  42. //$sys_info['curl'] = function_exists('curl_init') ? 'YES' : 'NO'; //Curl支持
  43. //$sys_info['max_ex_time'] = @ini_get("max_execution_time") . 's';
  44. $sys_info['domain'] = $_SERVER['HTTP_HOST']; //域名
  45. $sys_info['remaining_space'] = function_exists('disk_free_space') ? round((disk_free_space(".") / (1024 * 1024)), 2) . 'M' : '未知'; //剩余空间
  46. //$sys_info['user_ip'] = $_SERVER['REMOTE_ADDR']; //用户IP地址
  47. $sys_info['beijing_time'] = gmdate("Y年n月j日 H:i:s", time() + 8 * 3600); //北京时间
  48. $sys_info['time'] = date("Y年n月j日 H:i:s"); //服务器时间
  49. //$sys_info['web_directory'] = $_SERVER["DOCUMENT_ROOT"]; //网站目录
  50. $mysqlinfo = Db::query("SELECT VERSION() as version");
  51. $sys_info['mysql_version'] = $mysqlinfo[0]['version'];
  52. if (function_exists("gd_info")) {
  53. //GD库版本
  54. $gd = gd_info();
  55. $sys_info['gdinfo'] = $gd['GD Version'];
  56. } else {
  57. $sys_info['gdinfo'] = "未知";
  58. }
  59. return $sys_info;
  60. }
  61. }