In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "php how to judge the current operating environment according to system variables", the content is easy to understand, clear, hope to help you solve doubts, the following let Xiaobian lead you to study and learn "php how to judge the current operating environment according to system variables" this article.
Judge the current operating environment according to system variables
By default, the system determines whether the local environment is based on specifying a set of host names in the 'local' array as the host names of the local environment. For example, if you have to do development on the office computer and Macbook, you have to write both host names in it. I think this is very troublesome. Instead, it will be judged by $_ SERVER ['LARAVEL_ENV'], so I can define the environment variable of' LARAVEL_ENV''in all development machines, the value 'local',' will be automatically recognized as' local' environment on the development machine, and in other cases it will be 'production'.
The code is as follows:
/ / the default way of writing is to determine whether the local environment $env = $app- > detectEnvironment ('local' = > array (' homestead');)) based on the hostname; / / modify it to determine whether the system variable is specified first, and then determine whether the hostname $env = $app- > detectEnvironment (function () {$_ env = getenv ('LARAVEL_ENV'))? Getenv ('LARAVEL_ENV'): array (' local' = > array ('homestead'); return $_ env;}); / / this is actually to read the value of $_ SERVER [' LARAVEL_ENV'] / / in Apache, you can set it with SetEnv, / / in Nginx, you can use fastcgi_param to set all the contents of the article "how php judges the current running environment based on system variables". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.