PHP字符串转码
2022-07-28 15:09:43
103
{{single.collect_count}}
/** * 字符串转码 utf-8转换成gbk 或者gbk转换成utf-8 ** @param String $string 需要转码的字符串 * @param String $toType 需要转换的字符编码,默认UTF-8 * * @return String 返回转码后的字符串 * */function transCoding($string, $toType = "UTF-8"){if ($toType == "UTF-8") {$string = iconv("GBK", "UTF-8", $string);} else {$string = iconv("UTF-8", "GBK", $string);}return $string;}$re = $this->transCoding('测试','GBK');print_r($re);$res = $this->transCoding($re,'UTF-8');print_r($res);
回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}