/** * 调用字典服务翻译内容 * * @param $key * * @return mixed */ public static function dictionaryName($key) { if (empty($key)) { return $key; } $metaDictionaryService = new MetaDictionaryService(); $dictItem = $metaDictionaryService->getWord($key, 600); //缓存 10 分钟 return $dictItem['name']; }
/** * 根据字典中数据转换显示 * * @param $key * * @return mixed */ function smarty_helper_modifier_dictionary_name($key) { if (empty($key)) { return $key; } $metaDictionaryService = new MetaDictionaryService(); $dictItem = $metaDictionaryService->getWord($key, 600); //缓存 10 分钟 return $dictItem['name']; }