Exemple #1
0
 /**
  * 获取语言 不区分大小写
  *  获取值的时候可以动态传参转出语言值
  *  如:\Foundation\Lang::get('_DEBUG_ADD_CLASS_TIP_', '\Foundation\Base') 取出_DEBUG_ADD_CLASS_TIP_语言变量且将\Foundation\base替换语言中的%s
  *
  * @param string $key 支持.获取多维数组
  * @param string $default 不存在的时候默认值
  *
  * @return string
  */
 public static function get($key = null, $default = '')
 {
     if (empty($key)) {
         return '';
     }
     $replace = func_get_args();
     $key = strtolower($key);
     $val = Alpha::doteToArr($key, self::$_content['normal']);
     if (is_null($val)) {
         return $default;
     } else {
         $replace[0] = $val;
         return call_user_func_array('sprintf', array_values($replace));
     }
 }