Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

2 лет назад
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. namespace crmeb\utils;
  3. use think\App;
  4. /**
  5. * Start输出类
  6. * Class Json
  7. */
  8. class Start
  9. {
  10. public function show()
  11. {
  12. $this->opCacheClear();
  13. $context = $this->logo();
  14. $context .= $this->displayItem('php version', phpversion());
  15. $context .= $this->displayItem('swoole version', phpversion('swoole'));
  16. $context .= $this->displayItem('thinkphp version', App::VERSION);
  17. $context .= $this->displayItem('crmeb version', get_crmeb_version());
  18. //http配置
  19. $httpConf = \config("swoole.http");
  20. $context .= $this->displayItem('http enable', $httpConf["enable"]);
  21. $context .= $this->displayItem('http host', $httpConf["host"]);
  22. $context .= $this->displayItem('http port', $httpConf["port"]);
  23. $context .= $this->displayItem('http worker_num', $httpConf["worker_num"]);
  24. //websocket配置
  25. $context .= $this->displayItem('websocket enable', \config("swoole.websocket.enable"));
  26. //rpc配置
  27. $rpcConf = \config("swoole.rpc.server");
  28. $context .= $this->displayItem('rpc enable', $rpcConf["enable"]);
  29. if ($rpcConf["enable"]) {
  30. $context .= $this->displayItem('rpc host', $rpcConf["host"]);
  31. $context .= $this->displayItem('rpc port', $rpcConf["port"]);
  32. $context .= $this->displayItem('rpc worker_num', $rpcConf["worker_num"]);
  33. }
  34. //队列配置
  35. $context .= $this->displayItem('queue enable', \config("swoole.queue.enable"));
  36. //热更新配置
  37. $context .= $this->displayItem('hot_update enable', \config("swoole.hot_update.enable") ? true : false);
  38. //debug配置
  39. $context .= $this->displayItem('app_debug enable', env("APP_DEBUG") ? true : false);
  40. //打印信息
  41. echo $context;
  42. }
  43. private function logo()
  44. {
  45. return <<<LOGO
  46. ██████ ███████ ████ ████ ████████ ██████ ███████ ███████ ███████
  47. ██░░░░██ ░██░░░░██ ░██░██ ██░██ ░██░░░░░ ░█░░░░██ ░██░░░░██ ░██░░░░██ ██░░░░░██
  48. ██ ░░ ░██ ░██ ░██░░██ ██ ░██ ░██ ░█ ░██ ░██ ░██ ░██ ░██ ██ ░░██
  49. ░██ ░███████ ░██ ░░███ ░██ ░███████ ░██████ █████ ░███████ ░███████ ░██ ░██
  50. ░██ ░██░░░██ ░██ ░░█ ░██ ░██░░░░ ░█░░░░ ██ ░░░░░ ░██░░░░ ░██░░░██ ░██ ░██
  51. ░░██ ██ ░██ ░░██ ░██ ░ ░██ ░██ ░█ ░██ ░██ ░██ ░░██ ░░██ ██
  52. ░░██████ ░██ ░░██ ░██ ░██ ░████████ ░███████ ░██ ░██ ░░██ ░░███████
  53. ░░░░░░ ░░ ░░ ░░ ░░ ░░░░░░░░ ░░░░░░░ ░░ ░░ ░░ ░░░░░░░
  54. LOGO;
  55. }
  56. private function displayItem($name, $value)
  57. {
  58. if ($value === true) {
  59. $value = 'true';
  60. }
  61. elseif ($value === false) {
  62. $value = 'false';
  63. }
  64. elseif ($value === null) {
  65. $value = 'null';
  66. }
  67. return "\e[32m" . str_pad($name, 30, ' ', STR_PAD_RIGHT) . "\e[34m" . $value . "\e[0m \n";
  68. }
  69. private function opCacheClear()
  70. {
  71. if (function_exists('apc_clear_cache')) {
  72. apc_clear_cache();
  73. }
  74. if (function_exists('opcache_reset')) {
  75. opcache_reset();
  76. }
  77. }
  78. }