<?php// +----------------------------------------------------------------------// | thinkphp [ we can do it just think ]// +--------------------------------- -------------------------------------// | copyright (c) 2006~2016 http://thinkphp.cn all rights reserved.// +----------------------------------------------------------------- -----// | licensed ( http://www.apache.org/licenses/LICENSE-2.0 )// +----------- -----------------------------------------------------------// | author: liu21st <[email protected]>// +----------------------------------------------------------------------Namespace think;// Environment Configuration class class env{ /** * Get environment variable Value * @param string $name environment variable name (supports level two &NBSP) * @param string $default defaults * @return mixed */ public static function get ($name, $default = null)// simple environment functions Get Configuration { $result = getenv (env_ Prefix . strtoupper (Str_replace ('. ', ' _ ', $name)); if (false !== $result) { // default return return $result; } else { return $ default; } }}
This article is from the "Focus on PHP Group number: 414194301" blog, please be sure to keep this source http://jingshanls.blog.51cto.com/3357095/1877549
[Li Jingshan php] every day tp5-20170102|thinkphp5-env.php