<?php

namespace support;

use DateTime;
use DateTimeZone;

/**
 * 日期时间处理类
 */
class Env
{
    static function get($name='',$default=null){
        $envfn = run_path().'/.env';
        $env = parse_ini_file($envfn,true);
        $ret = $env;
        if(!$name){
            return $env;
        }
        $names = explode('.',$name);
        if(!isset($ret[$names[0]])){
            return $default;
        }
        foreach($names as $_name){
            if(isset($ret[$_name])){
                $ret = $ret[$_name];
            }else{
                return $default;
            }
        }
        return $ret;
    }
}