language) { case 'ft': $op = opencc_open($env); $content = opencc_convert($content, $op); opencc_close($op); return $content; break; default: return $content; break; } } } public static function ArrayConvert(&$data, $key, $env = 1) { switch ($env) { case 1: $envData = "s2hk.json"; break; } switch (Yii::$app->language) { case 'ft': $op = opencc_open($envData); if (!empty($data) && is_array($data)) { foreach ($data as &$val) { if (isset($key) && is_array($key)) { foreach ($key as $v) { isset($val[$v]) ? $val[$v] = opencc_convert($val[$v], $op) : ''; } } if (is_string($key)) { isset($val[$key]) ? $val[$key] = opencc_convert($val[$key], $op) : ''; } } } opencc_close($op); break; default: break; } } public static function ConvertHn($content, $json = 1) { if (!empty($content)) { return $content; } } }