Cml\Lang::get PHP 메소드

get() 공개 정적인 메소드

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

Usage Example

예제 #1
0
파일: Apc.php 프로젝트: linhecheng/cmlphp
 /**
  * 使用的缓存配置 默认为使用default_cache配置的参数
  *
  * @param bool|array $conf
  *
  * @throws PhpExtendNotInstall
  */
 public function __construct($conf = false)
 {
     if (!function_exists('apc_cache_info')) {
         throw new PhpExtendNotInstall(Lang::get('_CACHE_EXTENT_NOT_INSTALL_', 'Apc'));
     }
     $this->conf = $conf ? $conf : Config::get('default_cache');
 }
All Usage Examples Of Cml\Lang::get