标签:thinkphp
<?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 <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think;
// 环境配置 类
class Env
{
/**
* 获取环境变量值
* @param string $name 环境变量名(支持二级 .号分割)
* @param string $default 默认值
* @return mixed
*/
public static function get($name, $default = null)// 简单的 环境 函数 获取配置
{
$result = getenv(ENV_PREFIX . strtoupper(str_replace(‘.‘, ‘_‘, $name)));
if (false !== $result) { // 默认情况 返回
return $result;
} else {
return $default;
}
}
}本文出自 “专注php 群号:414194301” 博客,请务必保留此出处http://jingshanls.blog.51cto.com/3357095/1877549
[李景山php]每天TP5-20170102|thinkphp5-Env.php
标签:thinkphp
原文地址:http://jingshanls.blog.51cto.com/3357095/1877549